<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- (c) The University of Glasgow 2006</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Core.Coercion.Opt</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier">optCoercion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier">checkAxInstCo</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-9"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-12"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html"><span class="hs-identifier">GHC.Core.TyCo.Rep</span></a></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html"><span class="hs-identifier">GHC.Core.TyCo.Subst</span></a></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Type</span></span><span> </span><span class="hs-keyword">hiding</span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyVarBndr"><span class="hs-identifier">substTyVarBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier">substTy</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier">exactTyCoVarsOfType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html"><span class="hs-identifier">GHC.Core.Coercion.Axiom</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#flattenTys"><span class="hs-identifier">flattenTys</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html"><span class="hs-identifier">GHC.Data.Pair</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-identifier">getNth</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Unify.html"><span class="hs-identifier">GHC.Core.Unify</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.InstEnv.html"><span class="hs-identifier">GHC.Core.InstEnv</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier">zipWithM</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
                 Optimising coercions
%*                                                                      *
%************************************************************************

Note [Optimising coercion optimisation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Looking up a coercion's role or kind is linear in the size of the
coercion. Thus, doing this repeatedly during the recursive descent
of coercion optimisation is disastrous. We must be careful to avoid
doing this if at all possible.

Because it is generally easy to know a coercion's components' roles
from the role of the outer coercion, we pass down the known role of
the input in the algorithm below. We also keep functions opt_co2
and opt_co3 separate from opt_co4, so that the former two do Phantom
checks that opt_co4 can avoid. This is a big win because Phantom coercions
rarely appear within non-phantom coercions -- only in some TyConAppCos
and some AxiomInstCos. We handle these cases specially by calling
opt_co2.

Note [Optimising InstCo]
~~~~~~~~~~~~~~~~~~~~~~~~
(1) tv is a type variable
When we have (InstCo (ForAllCo tv h g) g2), we want to optimise.

Let's look at the typing rules.

h : k1 ~ k2
tv:k1 |- g : t1 ~ t2
-----------------------------
ForAllCo tv h g : (all tv:k1.t1) ~ (all tv:k2.t2[tv |-&gt; tv |&gt; sym h])

g1 : (all tv:k1.t1') ~ (all tv:k2.t2')
g2 : s1 ~ s2
--------------------
InstCo g1 g2 : t1'[tv |-&gt; s1] ~ t2'[tv |-&gt; s2]

We thus want some coercion proving this:

  (t1[tv |-&gt; s1]) ~ (t2[tv |-&gt; s2 |&gt; sym h])

If we substitute the *type* tv for the *coercion*
(g2 ; t2 ~ t2 |&gt; sym h) in g, we'll get this result exactly.
This is bizarre,
though, because we're substituting a type variable with a coercion. However,
this operation already exists: it's called *lifting*, and defined in GHC.Core.Coercion.
We just need to enhance the lifting operation to be able to deal with
an ambient substitution, which is why a LiftingContext stores a TCvSubst.

(2) cv is a coercion variable
Now consider we have (InstCo (ForAllCo cv h g) g2), we want to optimise.

h : (t1 ~r t2) ~N (t3 ~r t4)
cv : t1 ~r t2 |- g : t1' ~r2 t2'
n1 = nth r 2 (downgradeRole r N h) :: t1 ~r t3
n2 = nth r 3 (downgradeRole r N h) :: t2 ~r t4
------------------------------------------------
ForAllCo cv h g : (all cv:t1 ~r t2. t1') ~r2
                  (all cv:t3 ~r t4. t2'[cv |-&gt; n1 ; cv ; sym n2])

g1 : (all cv:t1 ~r t2. t1') ~ (all cv: t3 ~r t4. t2')
g2 : h1 ~N h2
h1 : t1 ~r t2
h2 : t3 ~r t4
------------------------------------------------
InstCo g1 g2 : t1'[cv |-&gt; h1] ~ t2'[cv |-&gt; h2]

We thus want some coercion proving this:

  t1'[cv |-&gt; h1] ~ t2'[cv |-&gt; n1 ; h2; sym n2]

So we substitute the coercion variable c for the coercion
(h1 ~N (n1; h2; sym n2)) in g.
-}</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier hs-type">optCoercion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- ^ optCoercion applies a substitution to a coercion,</span><span>
</span><span id="line-110"></span><span class="hs-comment">--   *and* optimises it to reduce its size</span><span>
</span><span id="line-111"></span><span id="optCoercion"><span class="annot"><span class="annottext">optCoercion :: DynFlags -&gt; TCvSubst -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier hs-var hs-var">optCoercion</span></a></span></span><span> </span><span id="local-6989586621680928050"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680928050"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680928049"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680928049"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928048"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928048"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-112"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#hasNoOptCoercion"><span class="hs-identifier hs-var">hasNoOptCoercion</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680928050"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Coercion -&gt; Coercion
TCvSubst -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Subst.html#substCo"><span class="hs-identifier hs-var">substCo</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680928049"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928048"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-113"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#optCoercion%27"><span class="hs-identifier hs-var">optCoercion'</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680928049"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928048"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#optCoercion%27"><span class="hs-identifier hs-type">optCoercion'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-116"></span><span id="optCoercion%27"><span class="annot"><span class="annottext">optCoercion' :: TCvSubst -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#optCoercion%27"><span class="hs-identifier hs-var hs-var">optCoercion'</span></a></span></span><span> </span><span id="local-6989586621680928044"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680928044"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928043"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928043"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-117"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Utils.Misc.html#debugIsOn"><span class="hs-identifier hs-var">debugIsOn</span></a></span><span>
</span><span id="line-118"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680928041"><span class="annot"><span class="annottext">out_co :: Coercion
</span><a href="#local-6989586621680928041"><span class="hs-identifier hs-var hs-var">out_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var">opt_co1</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928039"><span class="hs-identifier hs-var">lc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928043"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680928037"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680928037"><span class="hs-identifier hs-var">in_ty1</span></a></span></span><span>  </span><span id="local-6989586621680928036"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680928036"><span class="hs-identifier hs-var">in_ty2</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680928035"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680928035"><span class="hs-identifier hs-var">in_role</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; (Pair Type, Role)
</span><a href="GHC.Core.Coercion.html#coercionKindRole"><span class="hs-identifier hs-var">coercionKindRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928043"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-120"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680928033"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680928033"><span class="hs-identifier hs-var">out_ty1</span></a></span></span><span> </span><span id="local-6989586621680928032"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680928032"><span class="hs-identifier hs-var">out_ty2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680928031"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680928031"><span class="hs-identifier hs-var">out_role</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; (Pair Type, Role)
</span><a href="GHC.Core.Coercion.html#coercionKindRole"><span class="hs-identifier hs-var">coercionKindRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928041"><span class="hs-identifier hs-var">out_co</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">substTyUnchecked</span><span> </span><span class="hs-identifier">env</span><span> </span><span class="hs-identifier">in_ty1</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">eqType</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">out_ty1</span><span> </span><span class="hs-operator">&amp;&amp;</span><span>
</span><span id="line-123"></span><span>             </span><span class="hs-identifier">substTyUnchecked</span><span> </span><span class="hs-identifier">env</span><span> </span><span class="hs-identifier">in_ty2</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">eqType</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">out_ty2</span><span> </span><span class="hs-operator">&amp;&amp;</span><span>
</span><span id="line-124"></span><span>             </span><span class="hs-identifier">in_role</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">out_role</span><span>
</span><span id="line-125"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;optCoercion changed types!&quot;</span><span>
</span><span id="line-126"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;in_co:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">co</span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;in_ty1:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_ty1</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;in_ty2:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_ty2</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;out_co:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">out_co</span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;out_ty1:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">out_ty1</span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;out_ty2:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">out_ty2</span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span>             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">hang</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;subst:&quot;</span><span class="hs-special">)</span><span> </span><span class="hs-number">2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">env</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>    </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928041"><span class="hs-identifier hs-var">out_co</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var">opt_co1</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928039"><span class="hs-identifier hs-var">lc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928043"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-136"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-137"></span><span>    </span><span id="local-6989586621680928039"><span class="annot"><span class="annottext">lc :: LiftingContext
</span><a href="#local-6989586621680928039"><span class="hs-identifier hs-var hs-var">lc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#mkSubstLiftingContext"><span class="hs-identifier hs-var">mkSubstLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680928044"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-keyword">type</span><span> </span><span id="NormalCo"><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-var">NormalCo</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-140"></span><span>  </span><span class="hs-comment">-- Invariants:</span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-comment">--  * The substitution has been fully applied</span><span>
</span><span id="line-142"></span><span>  </span><span class="hs-comment">--  * For trans coercions (co1 `trans` co2)</span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-comment">--       co1 is not a trans, and neither co1 nor co2 is identity</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-keyword">type</span><span> </span><span id="NormalNonIdCo"><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-var">NormalNonIdCo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>  </span><span class="hs-comment">-- Extra invariant: not the identity</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-comment">-- | Do we apply a @sym@ to the result?</span><span>
</span><span id="line-148"></span><span class="hs-keyword">type</span><span> </span><span id="SymFlag"><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-var">SymFlag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="hs-comment">-- | Do we force the result to be representational?</span><span>
</span><span id="line-151"></span><span class="hs-keyword">type</span><span> </span><span id="ReprFlag"><span class="annot"><a href="GHC.Core.Coercion.Opt.html#ReprFlag"><span class="hs-identifier hs-var">ReprFlag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-comment">-- | Optimize a coercion, making no assumptions. All coercions in</span><span>
</span><span id="line-154"></span><span class="hs-comment">-- the lifting context are already optimized (and sym'd if nec'y)</span><span>
</span><span id="line-155"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-type">opt_co1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span>
</span><span id="line-156"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-158"></span><span id="opt_co1"><span class="annot"><span class="annottext">opt_co1 :: LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var hs-var">opt_co1</span></a></span></span><span> </span><span id="local-6989586621680928017"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928017"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928016"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928016"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680928015"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928015"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var">opt_co2</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928017"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928016"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928015"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928015"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-comment">-- See Note [Optimising coercion optimisation]</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- | Optimize a coercion, knowing the coercion's role. No other assumptions.</span><span>
</span><span id="line-162"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-type">opt_co2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>   </span><span class="hs-comment">-- ^ The role of the input coercion</span><span>
</span><span id="line-165"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-166"></span><span id="opt_co2"><span class="annot"><span class="annottext">opt_co2 :: LiftingContext -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var hs-var">opt_co2</span></a></span></span><span> </span><span id="local-6989586621680928012"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928012"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928011"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928011"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Phantom"><span class="hs-identifier hs-var">Phantom</span></a></span><span> </span><span id="local-6989586621680928009"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928009"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_phantom"><span class="hs-identifier hs-var">opt_phantom</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928012"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928011"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928009"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-167"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var">opt_co2</span></a></span><span> </span><span id="local-6989586621680928007"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928007"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928006"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928006"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680928005"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680928005"><span class="hs-identifier hs-var">r</span></a></span></span><span>       </span><span id="local-6989586621680928004"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928004"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; Maybe Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-var">opt_co3</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928007"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928006"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Role
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680928005"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928004"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span class="hs-comment">-- See Note [Optimising coercion optimisation]</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- | Optimize a coercion, knowing the coercion's non-Phantom role.</span><span>
</span><span id="line-171"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-type">opt_co3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-172"></span><span id="opt_co3"><span class="annot"><span class="annottext">opt_co3 :: LiftingContext
-&gt; Bool -&gt; Maybe Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-var hs-var">opt_co3</span></a></span></span><span> </span><span id="local-6989586621680928002"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928002"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680928001"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928001"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Phantom"><span class="hs-identifier hs-var">Phantom</span></a></span><span class="hs-special">)</span><span>          </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680928000"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928000"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_phantom"><span class="hs-identifier hs-var">opt_phantom</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680928002"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680928001"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680928000"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-173"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-var">opt_co3</span></a></span><span> </span><span id="local-6989586621680927999"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927999"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927998"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927998"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927996"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927996"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621680927995"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927995"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927999"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927998"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927996"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927995"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-174"></span><span>  </span><span class="hs-comment">-- if mrole is Just Nominal, that can't be a downgrade, so we can ignore</span><span>
</span><span id="line-175"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-var">opt_co3</span></a></span><span> </span><span id="local-6989586621680927993"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927993"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927992"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927992"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe Role
</span><span class="hs-identifier">_</span></span><span>                       </span><span id="local-6989586621680927991"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927991"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621680927990"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927990"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927993"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927992"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927991"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927990"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-comment">-- See Note [Optimising coercion optimisation]</span><span>
</span><span id="line-178"></span><span class="hs-comment">-- | Optimize a non-phantom coercion.</span><span>
</span><span id="line-179"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-type">opt_co4</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-type">opt_co4_wrap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#ReprFlag"><span class="hs-identifier hs-type">ReprFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span id="opt_co4_wrap"><span class="annot"><span class="annottext">opt_co4_wrap :: LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var hs-var">opt_co4_wrap</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span>
</span><span id="line-182"></span><span class="hs-comment">{-
opt_co4_wrap env sym rep r co
  = pprTrace &quot;opt_co4_wrap {&quot;
    ( vcat [ text &quot;Sym:&quot; &lt;+&gt; ppr sym
           , text &quot;Rep:&quot; &lt;+&gt; ppr rep
           , text &quot;Role:&quot; &lt;+&gt; ppr r
           , text &quot;Co:&quot; &lt;+&gt; ppr co ]) $
    ASSERT( r == coercionRole co )
    let result = opt_co4 env sym rep r co in
    pprTrace &quot;opt_co4_wrap }&quot; (ppr co $$ text &quot;---&quot; $$ ppr result) $
    result
-}</span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span id="opt_co4"><span class="annot"><span class="annottext">opt_co4 :: LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var hs-var">opt_co4</span></a></span></span><span> </span><span id="local-6989586621680927988"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927988"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621680927987"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927987"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927986"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927986"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Refl"><span class="hs-identifier hs-type">Refl</span></a></span><span> </span><span id="local-6989586621680927984"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927984"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">Nominal</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Expected role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">r</span><span>    </span><span class="hs-operator">$$</span><span>
</span><span id="line-197"></span><span>                           </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Found role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">Nominal</span><span> </span><span class="hs-operator">$$</span><span>
</span><span id="line-198"></span><span>                           </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Type:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927987"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927986"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927988"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927984"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927979"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927979"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621680927978"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927978"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927977"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927977"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#GRefl"><span class="hs-identifier hs-type">GRefl</span></a></span><span> </span><span id="local-6989586621680927975"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927975"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927974"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927974"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Expected role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">$$</span><span>
</span><span id="line-203"></span><span>                      </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Found role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">_r</span><span>   </span><span class="hs-operator">$$</span><span>
</span><span id="line-204"></span><span>                      </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Type:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927978"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927977"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927979"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927974"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927972"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927972"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927971"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927971"><span class="hs-identifier hs-var">sym</span></a></span></span><span>  </span><span id="local-6989586621680927970"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927970"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927969"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927969"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#GRefl"><span class="hs-identifier hs-type">GRefl</span></a></span><span> </span><span id="local-6989586621680927968"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927968"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927967"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927967"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-type">MCo</span></a></span><span> </span><span id="local-6989586621680927965"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927965"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Expected role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">$$</span><span>
</span><span id="line-209"></span><span>                      </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Found role:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">_r</span><span>   </span><span class="hs-operator">$$</span><span>
</span><span id="line-210"></span><span>                      </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;Type:&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isGReflCo"><span class="hs-identifier hs-var">isGReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927965"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isGReflCo"><span class="hs-identifier hs-var">isGReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927962"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927961"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927972"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927967"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var">wrapSym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927971"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoherenceRightCo"><span class="hs-identifier hs-var">mkCoherenceRightCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927961"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927958"><span class="hs-identifier hs-var">ty'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927962"><span class="hs-identifier hs-var">co'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927961"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927972"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927967"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-215"></span><span>    </span><span id="local-6989586621680927961"><span class="annot"><span class="annottext">r' :: Role
</span><a href="#local-6989586621680927961"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927970"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927969"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-216"></span><span>    </span><span id="local-6989586621680927958"><span class="annot"><span class="annottext">ty' :: Type
</span><a href="#local-6989586621680927958"><span class="hs-identifier hs-var hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Type -&gt; Type
TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcSubstLeft"><span class="hs-identifier hs-var">lcSubstLeft</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927972"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927967"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-217"></span><span>    </span><span id="local-6989586621680927962"><span class="annot"><span class="annottext">co' :: Coercion
</span><a href="#local-6989586621680927962"><span class="hs-identifier hs-var hs-var">co'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927972"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927965"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927954"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927954"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927953"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927953"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927952"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927952"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927951"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927951"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#SymCo"><span class="hs-identifier hs-type">SymCo</span></a></span><span> </span><span id="local-6989586621680927949"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927949"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927954"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927953"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927952"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927951"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927949"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-220"></span><span>  </span><span class="hs-comment">-- surprisingly, we don't have to do anything to the env here. This is</span><span>
</span><span id="line-221"></span><span>  </span><span class="hs-comment">-- because any &quot;lifting&quot; substitutions in the env are tied to ForAllCos,</span><span>
</span><span id="line-222"></span><span>  </span><span class="hs-comment">-- which treat their left and right sides differently. We don't want to</span><span>
</span><span id="line-223"></span><span>  </span><span class="hs-comment">-- exchange them.</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927948"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927948"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927947"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927947"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927946"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927946"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927945"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927945"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621680927944"><span class="annot"><span class="annottext">g :: Coercion
</span><a href="#local-6989586621680927944"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span id="local-6989586621680927942"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927942"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927941"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680927940"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927940"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927946"><span class="hs-identifier hs-var">rep</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927945"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-228"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-229"></span><span>        </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-230"></span><span>                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe Role -&gt; Role -&gt; Coercion -&gt; Coercion)
-&gt; [Maybe Role] -&gt; [Role] -&gt; [Coercion] -&gt; [Coercion]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="../../base/src/GHC.List.html#zipWith3"><span class="hs-identifier hs-var">zipWith3</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; Maybe Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co3"><span class="hs-identifier hs-var">opt_co3</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927948"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927947"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-231"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Role -&gt; Maybe Role) -&gt; [Role] -&gt; [Maybe Role]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Maybe Role
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesRepresentational"><span class="hs-identifier hs-var">tyConRolesRepresentational</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; [Role]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span>                               </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927940"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-235"></span><span>        </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927948"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927947"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927940"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-237"></span><span>                      </span><span class="hs-comment">-- must use opt_co2 here, because some roles may be P</span><span>
</span><span id="line-238"></span><span>                      </span><span class="hs-comment">-- See Note [Optimising coercion optimisation]</span><span>
</span><span id="line-239"></span><span>        </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927945"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Role -&gt; Coercion -&gt; Coercion)
-&gt; [Role] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var">opt_co2</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927948"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927947"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesRepresentational"><span class="hs-identifier hs-var">tyConRolesRepresentational</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927941"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- the current roles</span><span>
</span><span id="line-241"></span><span>                                   </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927940"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Phantom"><span class="hs-identifier hs-var">Phantom</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Coercion
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;opt_co4 sees a phantom!&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927944"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927932"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927932"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927931"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927931"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927930"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927930"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927929"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927929"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927927"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927927"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927926"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927926"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkAppCo"><span class="hs-identifier hs-var">mkAppCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927932"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927931"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927930"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927929"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927927"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927932"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927931"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927926"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927924"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927924"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927923"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927923"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927922"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927922"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927921"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927921"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllCo"><span class="hs-identifier hs-type">ForAllCo</span></a></span><span> </span><span id="local-6989586621680927919"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927919"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680927918"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927918"><span class="hs-identifier hs-var">k_co</span></a></span></span><span> </span><span id="local-6989586621680927917"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927917"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool
-&gt; TyCoVar
-&gt; Coercion
-&gt; (LiftingContext, TyCoVar, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#optForAllCoBndr"><span class="hs-identifier hs-var">optForAllCoBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927924"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927923"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927919"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927918"><span class="hs-identifier hs-var">k_co</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-250"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680927915"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927915"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927914"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927914"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927913"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927913"><span class="hs-identifier hs-var">k_co'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkForAllCo"><span class="hs-identifier hs-var">mkForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927914"><span class="hs-identifier hs-var">tv'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927913"><span class="hs-identifier hs-var">k_co'</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-251"></span><span>                            </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927915"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927923"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927922"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927921"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927917"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-252"></span><span>     </span><span class="hs-comment">-- Use the &quot;mk&quot; functions to check for nested Refls</span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927911"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927911"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927910"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927910"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927909"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927909"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927908"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927908"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunCo"><span class="hs-identifier hs-type">FunCo</span></a></span><span> </span><span id="local-6989586621680927906"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927906"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927905"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927905"><span class="hs-identifier hs-var">cow</span></a></span></span><span> </span><span id="local-6989586621680927904"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927904"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927903"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927903"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927909"><span class="hs-identifier hs-var">rep</span></a></span><span>
</span><span id="line-257"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkFunCo"><span class="hs-identifier hs-var">mkFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927901"><span class="hs-identifier hs-var">cow'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927900"><span class="hs-identifier hs-var">co1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927899"><span class="hs-identifier hs-var">co2'</span></a></span><span>
</span><span id="line-258"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkFunCo"><span class="hs-identifier hs-var">mkFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927908"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927901"><span class="hs-identifier hs-var">cow'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927900"><span class="hs-identifier hs-var">co1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927899"><span class="hs-identifier hs-var">co2'</span></a></span><span>
</span><span id="line-259"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-260"></span><span>    </span><span id="local-6989586621680927900"><span class="annot"><span class="annottext">co1' :: Coercion
</span><a href="#local-6989586621680927900"><span class="hs-identifier hs-var hs-var">co1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927911"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927910"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927909"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927908"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927904"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-261"></span><span>    </span><span id="local-6989586621680927899"><span class="annot"><span class="annottext">co2' :: Coercion
</span><a href="#local-6989586621680927899"><span class="hs-identifier hs-var hs-var">co2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927911"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927910"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927909"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927908"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927903"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-262"></span><span>    </span><span id="local-6989586621680927901"><span class="annot"><span class="annottext">cow' :: Coercion
</span><a href="#local-6989586621680927901"><span class="hs-identifier hs-var hs-var">cow'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var">opt_co1</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927911"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927910"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927905"><span class="hs-identifier hs-var">cow</span></a></span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927898"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927898"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927897"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927897"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927896"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927896"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927895"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927895"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoVarCo"><span class="hs-identifier hs-type">CoVarCo</span></a></span><span> </span><span id="local-6989586621680927893"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927893"><span class="hs-identifier hs-var">cv</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927892"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927892"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; TyCoVar -&gt; Maybe Coercion
</span><a href="GHC.Core.TyCo.Subst.html#lookupCoVar"><span class="hs-identifier hs-var">lookupCoVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcTCvSubst"><span class="hs-identifier hs-var">lcTCvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927898"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927893"><span class="hs-identifier hs-var">cv</span></a></span><span>
</span><span id="line-266"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927898"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927897"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927896"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927895"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927892"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927888"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927887"><span class="hs-identifier hs-var">ty2</span></a></span><span>   </span><span class="hs-comment">-- See Note [Optimise CoVarCo to Refl]</span><span>
</span><span id="line-269"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkReflCo"><span class="hs-identifier hs-var">mkReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927896"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927895"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927888"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-270"></span><span>
</span><span id="line-271"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isCoVar</span><span> </span><span class="hs-identifier">cv1</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927896"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927895"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var">wrapSym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927897"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-274"></span><span>    </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#CoVarCo"><span class="hs-identifier hs-var">CoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927884"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-277"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927888"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927888"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927887"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927887"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyCoVar -&gt; Pair Type
TyCoVar -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coVarTypes"><span class="hs-identifier hs-var">coVarTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927884"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>    </span><span id="local-6989586621680927884"><span class="annot"><span class="annottext">cv1 :: TyCoVar
</span><a href="#local-6989586621680927884"><span class="hs-identifier hs-var hs-var">cv1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; TyCoVar -&gt; Maybe TyCoVar
</span><a href="GHC.Types.Var.Env.html#lookupInScope"><span class="hs-identifier hs-var">lookupInScope</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; InScopeSet
</span><a href="GHC.Core.Coercion.html#lcInScopeSet"><span class="hs-identifier hs-var">lcInScopeSet</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927898"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927893"><span class="hs-identifier hs-var">cv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-280"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927872"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927872"><span class="hs-identifier hs-var">cv1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927872"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-281"></span><span>             </span><span class="annot"><span class="annottext">Maybe TyCoVar
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">True</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;opt_co: not in scope:&quot;</span><span>
</span><span id="line-282"></span><span>                                     </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">cv</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">env</span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>                         </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927893"><span class="hs-identifier hs-var">cv</span></a></span><span>
</span><span id="line-284"></span><span>          </span><span class="hs-comment">-- cv1 might have a substituted kind!</span><span>
</span><span id="line-285"></span><span>
</span><span id="line-286"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#HoleCo"><span class="hs-identifier hs-type">HoleCo</span></a></span><span> </span><span id="local-6989586621680927869"><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680927869"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-287"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Coercion
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;opt_univ fell into a hole&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionHole -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680927869"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927868"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927868"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927867"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927867"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927866"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927866"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927865"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927865"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-type">AxiomInstCo</span></a></span><span> </span><span id="local-6989586621680927863"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927863"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621680927862"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927862"><span class="hs-identifier hs-var">ind</span></a></span></span><span> </span><span id="local-6989586621680927861"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927861"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-comment">-- Do *not* push sym inside top-level axioms</span><span>
</span><span id="line-291"></span><span>    </span><span class="hs-comment">-- e.g. if g is a top-level axiom</span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-comment">--   g a : f a ~ a</span><span>
</span><span id="line-293"></span><span>    </span><span class="hs-comment">-- then (sym (g ty)) /= g (sym ty) !!</span><span>
</span><span id="line-294"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">coAxiomRole</span><span> </span><span class="hs-identifier">con</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-295"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927866"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Role
forall (br :: BranchFlag). CoAxiom br -&gt; Role
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomRole"><span class="hs-identifier hs-var">coAxiomRole</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927863"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-296"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var">wrapSym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927867"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-297"></span><span>                       </span><span class="hs-comment">-- some sub-cos might be P: use opt_co2</span><span>
</span><span id="line-298"></span><span>                       </span><span class="hs-comment">-- See Note [Optimising coercion optimisation]</span><span>
</span><span id="line-299"></span><span>    </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-var">AxiomInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927863"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927862"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Role -&gt; Coercion -&gt; Coercion)
-&gt; [Role] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var">opt_co2</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927868"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span>                                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxBranch -&gt; [Role]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchRoles"><span class="hs-identifier hs-var">coAxBranchRoles</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; CoAxBranch
forall (br :: BranchFlag). CoAxiom br -&gt; Int -&gt; CoAxBranch
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomNthBranch"><span class="hs-identifier hs-var">coAxiomNthBranch</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927863"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927862"><span class="hs-identifier hs-var">ind</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-301"></span><span>                                 </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927861"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span>      </span><span class="hs-comment">-- Note that the_co does *not* have sym pushed into it</span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927857"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927857"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927856"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927856"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927855"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927855"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927854"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927854"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#UnivCo"><span class="hs-identifier hs-type">UnivCo</span></a></span><span> </span><span id="local-6989586621680927852"><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927852"><span class="hs-identifier hs-var">prov</span></a></span></span><span> </span><span id="local-6989586621680927851"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927851"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927850"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927850"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680927849"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927849"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-305"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-306"></span><span>    </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var">opt_univ</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927857"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927856"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927852"><span class="hs-identifier hs-var">prov</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927855"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927854"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927850"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927849"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927847"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927847"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927846"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927846"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927845"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927845"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927844"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927844"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TransCo"><span class="hs-identifier hs-type">TransCo</span></a></span><span> </span><span id="local-6989586621680927842"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927842"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927841"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927841"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-309"></span><span>                      </span><span class="hs-comment">-- sym (g `o` h) = sym h `o` sym g</span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927846"><span class="hs-identifier hs-var">sym</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927839"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927838"><span class="hs-identifier hs-var">co2'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927837"><span class="hs-identifier hs-var">co1'</span></a></span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927839"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927837"><span class="hs-identifier hs-var">co1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927838"><span class="hs-identifier hs-var">co2'</span></a></span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-313"></span><span>    </span><span id="local-6989586621680927837"><span class="annot"><span class="annottext">co1' :: Coercion
</span><a href="#local-6989586621680927837"><span class="hs-identifier hs-var hs-var">co1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927847"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927846"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927845"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927844"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927842"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-314"></span><span>    </span><span id="local-6989586621680927838"><span class="annot"><span class="annottext">co2' :: Coercion
</span><a href="#local-6989586621680927838"><span class="hs-identifier hs-var hs-var">co2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927847"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927846"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927845"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927844"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927841"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-315"></span><span>    </span><span id="local-6989586621680927839"><span class="annot"><span class="annottext">in_scope :: InScopeSet
</span><a href="#local-6989586621680927839"><span class="hs-identifier hs-var hs-var">in_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; InScopeSet
</span><a href="GHC.Core.Coercion.html#lcInScopeSet"><span class="hs-identifier hs-var">lcInScopeSet</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927847"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-316"></span><span>
</span><span id="line-317"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927836"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927836"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927835"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927835"><span class="hs-identifier hs-var">_sym</span></a></span></span><span> </span><span id="local-6989586621680927834"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927834"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927833"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927833"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927831"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927831"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927830"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927830"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680927829"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927829"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927828"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927828"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Type, Role)
</span><a href="GHC.Core.Coercion.html#isReflCo_maybe"><span class="hs-identifier hs-var">isReflCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927829"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927826"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927826"><span class="hs-identifier hs-var">_tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927825"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927825"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>                        </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927828"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927834"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927833"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927836"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927825"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Int -&gt; Type
forall a. Outputable a =&gt; [a] -&gt; Int -&gt; a
</span><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-operator hs-var">`getNth`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927830"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927823"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927823"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Type, Role)
</span><a href="GHC.Core.Coercion.html#isReflCo_maybe"><span class="hs-identifier hs-var">isReflCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927829"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927830"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-324"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927822"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927822"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_maybe"><span class="hs-identifier hs-var">splitForAllTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927823"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-325"></span><span>      </span><span class="hs-comment">-- works for both tyvar and covar</span><span>
</span><span id="line-326"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
Role -&gt; LiftingContext -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubst"><span class="hs-identifier hs-var">liftCoSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927834"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927833"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927836"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927822"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927819"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927819"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927818"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927818"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927817"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927817"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927816"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927816"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927815"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927815"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927814"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927814"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927813"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927813"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-329"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>    </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927819"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927818"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927817"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927816"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927813"><span class="hs-identifier hs-var">cos</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion] -&gt; Int -&gt; Coercion
forall a. Outputable a =&gt; [a] -&gt; Int -&gt; a
</span><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-operator hs-var">`getNth`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927814"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927812"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927812"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927811"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927811"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927810"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927810"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927809"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927809"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927808"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927808"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927807"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927807"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllCo"><span class="hs-identifier hs-type">ForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927806"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927806"><span class="hs-identifier hs-var">eta</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-333"></span><span>      </span><span class="hs-comment">-- works for both tyvar and covar</span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_r</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-336"></span><span>    </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927812"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927811"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927810"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927806"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927805"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927805"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927804"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927804"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927803"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927803"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927802"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927802"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927801"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927801"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927800"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927800"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680927799"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927799"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-339"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927798"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927798"><span class="hs-identifier hs-var">cos</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927797"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927795"><span class="annot"><span class="annottext">nth_co :: Coercion
</span><a href="#local-6989586621680927795"><span class="hs-identifier hs-var hs-var">nth_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927798"><span class="hs-identifier hs-var">cos</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion] -&gt; Int -&gt; Coercion
forall a. Outputable a =&gt; [a] -&gt; Int -&gt; a
</span><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-operator hs-var">`getNth`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927800"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-341"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927803"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927802"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>      </span><span class="hs-comment">-- keep propagating the SubCo</span><span>
</span><span id="line-343"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927805"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927795"><span class="hs-identifier hs-var">nth_co</span></a></span><span>
</span><span id="line-344"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927795"><span class="hs-identifier hs-var">nth_co</span></a></span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllCo"><span class="hs-identifier hs-type">ForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927794"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927794"><span class="hs-identifier hs-var">eta</span></a></span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927797"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-347"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927803"><span class="hs-identifier hs-var">rep</span></a></span><span>
</span><span id="line-348"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927805"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927794"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-349"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927794"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-352"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927803"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927802"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-var">NthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927802"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927800"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927797"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-353"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-354"></span><span>    </span><span id="local-6989586621680927797"><span class="annot"><span class="annottext">co' :: Coercion
</span><a href="#local-6989586621680927797"><span class="hs-identifier hs-var hs-var">co'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var">opt_co1</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927805"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927804"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927799"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927793"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927793"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927792"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927792"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927791"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927791"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927790"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927790"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-type">LRCo</span></a></span><span> </span><span id="local-6989586621680927788"><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927788"><span class="hs-identifier hs-var">lr</span></a></span></span><span> </span><span id="local-6989586621680927787"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927787"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927786"><span class="annot"><span class="annottext">(Coercion, Coercion)
</span><a href="#local-6989586621680927786"><span class="hs-identifier hs-var">pr_co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitAppCo_maybe"><span class="hs-identifier hs-var">splitAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927787"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">Nominal</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-359"></span><span>    </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927793"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927792"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927791"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LeftOrRight -&gt; (Coercion, Coercion) -&gt; Coercion
forall {a}. LeftOrRight -&gt; (a, a) -&gt; a
</span><a href="#local-6989586621680927784"><span class="hs-identifier hs-var">pick_lr</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927788"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion, Coercion)
</span><a href="#local-6989586621680927786"><span class="hs-identifier hs-var">pr_co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-360"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927783"><span class="annot"><span class="annottext">(Coercion, Coercion)
</span><a href="#local-6989586621680927783"><span class="hs-identifier hs-var">pr_co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitAppCo_maybe"><span class="hs-identifier hs-var">splitAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927782"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-361"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">Nominal</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-362"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927791"><span class="hs-identifier hs-var">rep</span></a></span><span>
</span><span id="line-363"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927793"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LeftOrRight -&gt; (Coercion, Coercion) -&gt; Coercion
forall {a}. LeftOrRight -&gt; (a, a) -&gt; a
</span><a href="#local-6989586621680927784"><span class="hs-identifier hs-var">pick_lr</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927788"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion, Coercion)
</span><a href="#local-6989586621680927783"><span class="hs-identifier hs-var">pr_co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-364"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">LeftOrRight -&gt; (Coercion, Coercion) -&gt; Coercion
forall {a}. LeftOrRight -&gt; (a, a) -&gt; a
</span><a href="#local-6989586621680927784"><span class="hs-identifier hs-var">pick_lr</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927788"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion, Coercion)
</span><a href="#local-6989586621680927783"><span class="hs-identifier hs-var">pr_co</span></a></span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-366"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927791"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-var">LRCo</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927788"><span class="hs-identifier hs-var">lr</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927782"><span class="hs-identifier hs-var">co'</span></a></span><span>
</span><span id="line-367"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-368"></span><span>    </span><span id="local-6989586621680927782"><span class="annot"><span class="annottext">co' :: Coercion
</span><a href="#local-6989586621680927782"><span class="hs-identifier hs-var hs-var">co'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927793"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927792"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927787"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span>    </span><span id="local-6989586621680927784"><span class="annot"><span class="annottext">pick_lr :: LeftOrRight -&gt; (a, a) -&gt; a
</span><a href="#local-6989586621680927784"><span class="hs-identifier hs-var hs-var">pick_lr</span></a></span></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="GHC.Types.Basic.html#CLeft"><span class="hs-identifier hs-var">CLeft</span></a></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621680927780"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680927780"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680927780"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-371"></span><span>    </span><span class="annot"><a href="#local-6989586621680927784"><span class="hs-identifier hs-var">pick_lr</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="GHC.Types.Basic.html#CRight"><span class="hs-identifier hs-var">CRight</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927778"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680927778"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680927778"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-comment">-- See Note [Optimising InstCo]</span><span>
</span><span id="line-374"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927777"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927776"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927775"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927775"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927774"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927774"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#InstCo"><span class="hs-identifier hs-type">InstCo</span></a></span><span> </span><span id="local-6989586621680927772"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927772"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927771"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927771"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>    </span><span class="hs-comment">-- forall over type...</span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927770"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927770"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927769"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927769"><span class="hs-identifier hs-var">kind_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927768"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927768"><span class="hs-identifier hs-var">co_body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_ty_maybe"><span class="hs-identifier hs-var">splitForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927772"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TyCoVar -&gt; Coercion -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#extendLiftingContext"><span class="hs-identifier hs-var">extendLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927770"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-378"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoherenceRightCo"><span class="hs-identifier hs-var">mkCoherenceRightCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927765"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927769"><span class="hs-identifier hs-var">kind_co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927763"><span class="hs-identifier hs-var">sym_arg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-379"></span><span>                   </span><span class="hs-comment">-- mkSymCo kind_co :: k1 ~ k2</span><span>
</span><span id="line-380"></span><span>                   </span><span class="hs-comment">-- sym_arg :: (t1 :: k1) ~ (t2 :: k2)</span><span>
</span><span id="line-381"></span><span>                   </span><span class="hs-comment">-- tv |-&gt; (t1 :: k1) ~ (((t2 :: k2) |&gt; (sym kind_co)) :: k1)</span><span>
</span><span id="line-382"></span><span>                 </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927775"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927774"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927768"><span class="hs-identifier hs-var">co_body</span></a></span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span>    </span><span class="hs-comment">-- forall over coercion...</span><span>
</span><span id="line-385"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927762"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927762"><span class="hs-identifier hs-var">cv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927761"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927761"><span class="hs-identifier hs-var">kind_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927760"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927760"><span class="hs-identifier hs-var">co_body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_co_maybe"><span class="hs-identifier hs-var">splitForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927772"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-386"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621680927757"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927757"><span class="hs-identifier hs-var">h1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927756"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-387"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621680927755"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927755"><span class="hs-identifier hs-var">h2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927765"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927754"><span class="annot"><span class="annottext">new_co :: Coercion
</span><a href="#local-6989586621680927754"><span class="hs-identifier hs-var hs-var">new_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="#local-6989586621680927753"><span class="hs-identifier hs-var">mk_new_co</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927762"><span class="hs-identifier hs-var">cv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927761"><span class="hs-identifier hs-var">kind_co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927757"><span class="hs-identifier hs-var">h1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927755"><span class="hs-identifier hs-var">h2</span></a></span><span>
</span><span id="line-389"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TyCoVar -&gt; Coercion -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#extendLiftingContext"><span class="hs-identifier hs-var">extendLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927762"><span class="hs-identifier hs-var">cv</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927754"><span class="hs-identifier hs-var">new_co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927775"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927774"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927760"><span class="hs-identifier hs-var">co_body</span></a></span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span>    </span><span class="hs-comment">-- See if it is a forall after optimization</span><span>
</span><span id="line-392"></span><span>    </span><span class="hs-comment">-- If so, do an inefficient one-variable substitution, then re-optimize</span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span>    </span><span class="hs-comment">-- forall over type...</span><span>
</span><span id="line-395"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927752"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927752"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927751"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927751"><span class="hs-identifier hs-var">kind_co'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927750"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927750"><span class="hs-identifier hs-var">co_body'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_ty_maybe"><span class="hs-identifier hs-var">splitForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927749"><span class="hs-identifier hs-var">co1'</span></a></span><span>
</span><span id="line-396"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TyCoVar -&gt; Coercion -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#extendLiftingContext"><span class="hs-identifier hs-var">extendLiftingContext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927752"><span class="hs-identifier hs-var">tv'</span></a></span><span>
</span><span id="line-397"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoherenceRightCo"><span class="hs-identifier hs-var">mkCoherenceRightCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927748"><span class="hs-identifier hs-var">t2'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927751"><span class="hs-identifier hs-var">kind_co'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927747"><span class="hs-identifier hs-var">arg'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>            </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927746"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927750"><span class="hs-identifier hs-var">co_body'</span></a></span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span>    </span><span class="hs-comment">-- forall over coercion...</span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927745"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927745"><span class="hs-identifier hs-var">cv'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927744"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927744"><span class="hs-identifier hs-var">kind_co'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927743"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927743"><span class="hs-identifier hs-var">co_body'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_co_maybe"><span class="hs-identifier hs-var">splitForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927749"><span class="hs-identifier hs-var">co1'</span></a></span><span>
</span><span id="line-402"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621680927742"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927742"><span class="hs-identifier hs-var">h1'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927741"><span class="hs-identifier hs-var">t1'</span></a></span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621680927740"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927740"><span class="hs-identifier hs-var">h2'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927748"><span class="hs-identifier hs-var">t2'</span></a></span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927739"><span class="annot"><span class="annottext">new_co :: Coercion
</span><a href="#local-6989586621680927739"><span class="hs-identifier hs-var hs-var">new_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="#local-6989586621680927753"><span class="hs-identifier hs-var">mk_new_co</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927745"><span class="hs-identifier hs-var">cv'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927744"><span class="hs-identifier hs-var">kind_co'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927742"><span class="hs-identifier hs-var">h1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927740"><span class="hs-identifier hs-var">h2'</span></a></span><span>
</span><span id="line-405"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TyCoVar -&gt; Coercion -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#extendLiftingContext"><span class="hs-identifier hs-var">extendLiftingContext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; LiftingContext
</span><a href="GHC.Core.Coercion.html#zapLiftingContext"><span class="hs-identifier hs-var">zapLiftingContext</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927745"><span class="hs-identifier hs-var">cv'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927739"><span class="hs-identifier hs-var">new_co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-406"></span><span>                    </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927746"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927743"><span class="hs-identifier hs-var">co_body'</span></a></span><span>
</span><span id="line-407"></span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#InstCo"><span class="hs-identifier hs-var">InstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927749"><span class="hs-identifier hs-var">co1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927747"><span class="hs-identifier hs-var">arg'</span></a></span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-410"></span><span>    </span><span id="local-6989586621680927749"><span class="annot"><span class="annottext">co1' :: Coercion
</span><a href="#local-6989586621680927749"><span class="hs-identifier hs-var hs-var">co1'</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927775"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927774"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927772"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-411"></span><span>    </span><span id="local-6989586621680927746"><span class="annot"><span class="annottext">r' :: Role
</span><a href="#local-6989586621680927746"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927775"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927774"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-412"></span><span>    </span><span id="local-6989586621680927747"><span class="annot"><span class="annottext">arg' :: Coercion
</span><a href="#local-6989586621680927747"><span class="hs-identifier hs-var hs-var">arg'</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927777"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927771"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-413"></span><span>    </span><span id="local-6989586621680927763"><span class="annot"><span class="annottext">sym_arg :: Coercion
</span><a href="#local-6989586621680927763"><span class="hs-identifier hs-var hs-var">sym_arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var">wrapSym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927776"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927747"><span class="hs-identifier hs-var">arg'</span></a></span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span>    </span><span class="hs-comment">-- Performance note: don't be alarmed by the two calls to coercionKind</span><span>
</span><span id="line-416"></span><span>    </span><span class="hs-comment">-- here, as only one call to coercionKind is actually demanded per guard.</span><span>
</span><span id="line-417"></span><span>    </span><span class="hs-comment">-- t1/t2 are used when checking if co1 is a forall, and t1'/t2' are used</span><span>
</span><span id="line-418"></span><span>    </span><span class="hs-comment">-- when checking if co1' (i.e., co1 post-optimization) is a forall.</span><span>
</span><span id="line-419"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-420"></span><span>    </span><span class="hs-comment">-- t1/t2 must come from sym_arg, not arg', since it's possible that arg'</span><span>
</span><span id="line-421"></span><span>    </span><span class="hs-comment">-- might have an extra Sym at the front (after being optimized) that co1</span><span>
</span><span id="line-422"></span><span>    </span><span class="hs-comment">-- lacks, so we need to use sym_arg to balance the number of Syms. (#15725)</span><span>
</span><span id="line-423"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927756"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927756"><span class="hs-identifier hs-var">t1</span></a></span></span><span>  </span><span id="local-6989586621680927765"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927765"><span class="hs-identifier hs-var">t2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927763"><span class="hs-identifier hs-var">sym_arg</span></a></span><span>
</span><span id="line-424"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927741"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927741"><span class="hs-identifier hs-var">t1'</span></a></span></span><span> </span><span id="local-6989586621680927748"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927748"><span class="hs-identifier hs-var">t2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927747"><span class="hs-identifier hs-var">arg'</span></a></span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span>    </span><span id="local-6989586621680927753"><span class="annot"><span class="annottext">mk_new_co :: TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="#local-6989586621680927753"><span class="hs-identifier hs-var hs-var">mk_new_co</span></a></span></span><span> </span><span id="local-6989586621680927737"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927737"><span class="hs-identifier hs-var">cv</span></a></span></span><span> </span><span id="local-6989586621680927736"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927736"><span class="hs-identifier hs-var">kind_co</span></a></span></span><span> </span><span id="local-6989586621680927735"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927735"><span class="hs-identifier hs-var">h1</span></a></span></span><span> </span><span id="local-6989586621680927734"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927734"><span class="hs-identifier hs-var">h2</span></a></span></span><span>
</span><span id="line-427"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- h1 :: (t1 ~ t2)</span><span>
</span><span id="line-428"></span><span>            </span><span class="hs-comment">-- h2 :: (t3 ~ t4)</span><span>
</span><span id="line-429"></span><span>            </span><span class="hs-comment">-- kind_co :: (t1 ~ t2) ~ (t3 ~ t4)</span><span>
</span><span id="line-430"></span><span>            </span><span class="hs-comment">-- n1 :: t1 ~ t3</span><span>
</span><span id="line-431"></span><span>            </span><span class="hs-comment">-- n2 :: t2 ~ t4</span><span>
</span><span id="line-432"></span><span>            </span><span class="hs-comment">-- new_co = (h1 :: t1 ~ t2) ~ ((n1;h2;sym n2) :: t1 ~ t2)</span><span>
</span><span id="line-433"></span><span>            </span><span id="local-6989586621680927733"><span class="annot"><span class="annottext">r2 :: Role
</span><a href="#local-6989586621680927733"><span class="hs-identifier hs-var hs-var">r2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Role
</span><a href="GHC.Core.Coercion.html#coVarRole"><span class="hs-identifier hs-var">coVarRole</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927737"><span class="hs-identifier hs-var">cv</span></a></span><span>
</span><span id="line-434"></span><span>            </span><span id="local-6989586621680927731"><span class="annot"><span class="annottext">kind_co' :: Coercion
</span><a href="#local-6989586621680927731"><span class="hs-identifier hs-var hs-var">kind_co'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#downgradeRole"><span class="hs-identifier hs-var">downgradeRole</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927733"><span class="hs-identifier hs-var">r2</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927736"><span class="hs-identifier hs-var">kind_co</span></a></span><span>
</span><span id="line-435"></span><span>            </span><span id="local-6989586621680927728"><span class="annot"><span class="annottext">n1 :: Coercion
</span><a href="#local-6989586621680927728"><span class="hs-identifier hs-var hs-var">n1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927733"><span class="hs-identifier hs-var">r2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927731"><span class="hs-identifier hs-var">kind_co'</span></a></span><span>
</span><span id="line-436"></span><span>            </span><span id="local-6989586621680927725"><span class="annot"><span class="annottext">n2 :: Coercion
</span><a href="#local-6989586621680927725"><span class="hs-identifier hs-var hs-var">n2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927733"><span class="hs-identifier hs-var">r2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927731"><span class="hs-identifier hs-var">kind_co'</span></a></span><span>
</span><span id="line-437"></span><span>         </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkProofIrrelCo"><span class="hs-identifier hs-var">mkProofIrrelCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#Refl"><span class="hs-identifier hs-var">Refl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionType"><span class="hs-identifier hs-var">coercionType</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927735"><span class="hs-identifier hs-var">h1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927735"><span class="hs-identifier hs-var">h1</span></a></span><span>
</span><span id="line-438"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927728"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927734"><span class="hs-identifier hs-var">h2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927725"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927721"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927721"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927720"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927720"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927719"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927719"><span class="hs-identifier hs-var">_rep</span></a></span></span><span> </span><span id="local-6989586621680927718"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927718"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KindCo"><span class="hs-identifier hs-type">KindCo</span></a></span><span> </span><span id="local-6989586621680927716"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927716"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-441"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">Nominal</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-442"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927715"><span class="annot"><span class="annottext">kco' :: Coercion
</span><a href="#local-6989586621680927715"><span class="hs-identifier hs-var hs-var">kco'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#promoteCoercion"><span class="hs-identifier hs-var">promoteCoercion</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927716"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-443"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927715"><span class="hs-identifier hs-var">kco'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-444"></span><span>      </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KindCo"><span class="hs-identifier hs-type">KindCo</span></a></span><span> </span><span id="local-6989586621680927713"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927713"><span class="hs-identifier hs-var">co'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#promoteCoercion"><span class="hs-identifier hs-var">promoteCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co1"><span class="hs-identifier hs-var">opt_co1</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927721"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927720"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927713"><span class="hs-identifier hs-var">co'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span>      </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927721"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927720"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927715"><span class="hs-identifier hs-var">kco'</span></a></span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-comment">-- This might be able to be optimized more to do the promotion</span><span>
</span><span id="line-447"></span><span>  </span><span class="hs-comment">-- and substitution/optimization at the same time</span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927712"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927712"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927711"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927711"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927710"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927710"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#SubCo"><span class="hs-identifier hs-type">SubCo</span></a></span><span> </span><span id="local-6989586621680927708"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927708"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-450"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">Representational</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-451"></span><span>    </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927712"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927711"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927708"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="hs-comment">-- This could perhaps be optimized more.</span><span>
</span><span id="line-454"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span id="local-6989586621680927707"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927707"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927706"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927706"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927705"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927705"><span class="hs-identifier hs-var">rep</span></a></span></span><span> </span><span id="local-6989586621680927704"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927704"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AxiomRuleCo"><span class="hs-identifier hs-type">AxiomRuleCo</span></a></span><span> </span><span id="local-6989586621680927702"><span class="annot"><span class="annottext">CoAxiomRule
</span><a href="#local-6989586621680927702"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span id="local-6989586621680927701"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927701"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-455"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">coaxrRole</span><span> </span><span class="hs-identifier">co</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927705"><span class="hs-identifier hs-var">rep</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927704"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-457"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var">wrapSym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927706"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-458"></span><span>    </span><span class="annot"><span class="annottext">CoAxiomRule -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomRuleCo"><span class="hs-identifier hs-var">AxiomRuleCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiomRule
</span><a href="#local-6989586621680927702"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Role -&gt; Coercion -&gt; Coercion)
-&gt; [Role] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co2"><span class="hs-identifier hs-var">opt_co2</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927707"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxiomRule -&gt; [Role]
</span><a href="GHC.Core.Coercion.Axiom.html#coaxrAsmpRoles"><span class="hs-identifier hs-var hs-var">coaxrAsmpRoles</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiomRule
</span><a href="#local-6989586621680927702"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927701"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span class="hs-comment">{- Note [Optimise CoVarCo to Refl]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we have (c :: t~t) we can optimise it to Refl. That increases the
chances of floating the Refl upwards; e.g. Maybe c --&gt; Refl (Maybe t)

We do so here in optCoercion, not in mkCoVarCo; see Note [mkCoVarCo]
in GHC.Core.Coercion.
-}</span><span>
</span><span id="line-468"></span><span>
</span><span id="line-469"></span><span class="hs-comment">-------------</span><span>
</span><span id="line-470"></span><span class="hs-comment">-- | Optimize a phantom coercion. The input coercion may not necessarily</span><span>
</span><span id="line-471"></span><span class="hs-comment">-- be a phantom, but the output sure will be.</span><span>
</span><span id="line-472"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_phantom"><span class="hs-identifier hs-type">opt_phantom</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-473"></span><span id="opt_phantom"><span class="annot"><span class="annottext">opt_phantom :: LiftingContext -&gt; Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_phantom"><span class="hs-identifier hs-var hs-var">opt_phantom</span></a></span></span><span> </span><span id="local-6989586621680927698"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927698"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927697"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927697"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927696"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927696"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var">opt_univ</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927698"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927697"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-var">PhantomProv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkKindCo"><span class="hs-identifier hs-var">mkKindCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927696"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Phantom"><span class="hs-identifier hs-var">Phantom</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927693"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927692"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-475"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-476"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927693"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927693"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927692"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927692"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927696"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-477"></span><span>
</span><span id="line-478"></span><span class="hs-comment">{- Note [Differing kinds]
   ~~~~~~~~~~~~~~~~~~~~~~
The two types may not have the same kind (although that would be very unusual).
But even if they have the same kind, and the same type constructor, the number
of arguments in a `CoTyConApp` can differ. Consider

  Any :: forall k. k

  Any * Int                      :: *
  Any (*-&gt;*) Maybe Int  :: *

Hence the need to compare argument lengths; see #13658
 -}</span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-type">opt_univ</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#UnivCoProvenance"><span class="hs-identifier hs-type">UnivCoProvenance</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>
</span><span id="line-493"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-494"></span><span id="opt_univ"><span class="annot"><span class="annottext">opt_univ :: LiftingContext
-&gt; Bool -&gt; UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var hs-var">opt_univ</span></a></span></span><span> </span><span id="local-6989586621680927691"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927691"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927690"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927690"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-type">PhantomProv</span></a></span><span> </span><span id="local-6989586621680927689"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927689"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927688"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927688"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span id="local-6989586621680927687"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927687"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927686"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927686"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-495"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927690"><span class="hs-identifier hs-var">sym</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkPhantomCo"><span class="hs-identifier hs-var">mkPhantomCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927684"><span class="hs-identifier hs-var">h'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927683"><span class="hs-identifier hs-var">ty2'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927682"><span class="hs-identifier hs-var">ty1'</span></a></span><span>
</span><span id="line-496"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkPhantomCo"><span class="hs-identifier hs-var">mkPhantomCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927684"><span class="hs-identifier hs-var">h'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927682"><span class="hs-identifier hs-var">ty1'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927683"><span class="hs-identifier hs-var">ty2'</span></a></span><span>
</span><span id="line-497"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-498"></span><span>    </span><span id="local-6989586621680927684"><span class="annot"><span class="annottext">h' :: Coercion
</span><a href="#local-6989586621680927684"><span class="hs-identifier hs-var hs-var">h'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927691"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927690"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927689"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-499"></span><span>    </span><span id="local-6989586621680927682"><span class="annot"><span class="annottext">ty1' :: Type
</span><a href="#local-6989586621680927682"><span class="hs-identifier hs-var hs-var">ty1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Type -&gt; Type
TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcSubstLeft"><span class="hs-identifier hs-var">lcSubstLeft</span></a></span><span>  </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927691"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927687"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-500"></span><span>    </span><span id="local-6989586621680927683"><span class="annot"><span class="annottext">ty2' :: Type
</span><a href="#local-6989586621680927683"><span class="hs-identifier hs-var hs-var">ty2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Type -&gt; Type
TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcSubstRight"><span class="hs-identifier hs-var">lcSubstRight</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927691"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927686"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-501"></span><span>
</span><span id="line-502"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var">opt_univ</span></a></span><span> </span><span id="local-6989586621680927676"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927675"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927674"><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927674"><span class="hs-identifier hs-var">prov</span></a></span></span><span> </span><span id="local-6989586621680927673"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span></span><span> </span><span id="local-6989586621680927672"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927672"><span class="hs-identifier hs-var">oty1</span></a></span></span><span> </span><span id="local-6989586621680927671"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927671"><span class="hs-identifier hs-var">oty2</span></a></span></span><span>
</span><span id="line-503"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927670"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927670"><span class="hs-identifier hs-var">tc1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927669"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927669"><span class="hs-identifier hs-var">tys1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927672"><span class="hs-identifier hs-var">oty1</span></a></span><span>
</span><span id="line-504"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927668"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927668"><span class="hs-identifier hs-var">tc2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927667"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927667"><span class="hs-identifier hs-var">tys2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927671"><span class="hs-identifier hs-var">oty2</span></a></span><span>
</span><span id="line-505"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927670"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927668"><span class="hs-identifier hs-var">tc2</span></a></span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [Type] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927669"><span class="hs-identifier hs-var">tys1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927667"><span class="hs-identifier hs-var">tys2</span></a></span><span> </span><span class="hs-comment">-- see Note [Differing kinds]</span><span>
</span><span id="line-507"></span><span>      </span><span class="hs-comment">-- NB: prov must not be the two interesting ones (ProofIrrel &amp; Phantom);</span><span>
</span><span id="line-508"></span><span>      </span><span class="hs-comment">-- Phantom is already taken care of, and ProofIrrel doesn't relate tyconapps</span><span>
</span><span id="line-509"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927665"><span class="annot"><span class="annottext">roles :: [Role]
</span><a href="#local-6989586621680927665"><span class="hs-identifier hs-var hs-var">roles</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesX"><span class="hs-identifier hs-var">tyConRolesX</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927670"><span class="hs-identifier hs-var">tc1</span></a></span><span>
</span><span id="line-510"></span><span>        </span><span id="local-6989586621680927663"><span class="annot"><span class="annottext">arg_cos :: [Coercion]
</span><a href="#local-6989586621680927663"><span class="hs-identifier hs-var hs-var">arg_cos</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Role -&gt; Type -&gt; Type -&gt; Coercion)
-&gt; [Role] -&gt; [Type] -&gt; [Type] -&gt; [Coercion]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="../../base/src/GHC.List.html#zipWith3"><span class="hs-identifier hs-var">zipWith3</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkUnivCo"><span class="hs-identifier hs-var">mkUnivCo</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621680927665"><span class="hs-identifier hs-var">roles</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927669"><span class="hs-identifier hs-var">tys1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927667"><span class="hs-identifier hs-var">tys2</span></a></span><span>
</span><span id="line-511"></span><span>        </span><span id="local-6989586621680927660"><span class="annot"><span class="annottext">arg_cos' :: [Coercion]
</span><a href="#local-6989586621680927660"><span class="hs-identifier hs-var hs-var">arg_cos'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Role -&gt; Coercion -&gt; Coercion)
-&gt; [Role] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4"><span class="hs-identifier hs-var">opt_co4</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621680927665"><span class="hs-identifier hs-var">roles</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927663"><span class="hs-identifier hs-var">arg_cos</span></a></span><span>
</span><span id="line-512"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-513"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927670"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927660"><span class="hs-identifier hs-var">arg_cos'</span></a></span><span>
</span><span id="line-514"></span><span>
</span><span id="line-515"></span><span>  </span><span class="hs-comment">-- can't optimize the AppTy case because we can't build the kind coercions.</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927659"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927659"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927658"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927658"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_ty_maybe"><span class="hs-identifier hs-var">splitForAllTy_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927672"><span class="hs-identifier hs-var">oty1</span></a></span><span>
</span><span id="line-518"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927656"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927656"><span class="hs-identifier hs-var">tv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927655"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927655"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_ty_maybe"><span class="hs-identifier hs-var">splitForAllTy_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927671"><span class="hs-identifier hs-var">oty2</span></a></span><span>
</span><span id="line-519"></span><span>      </span><span class="hs-comment">-- NB: prov isn't interesting here either</span><span>
</span><span id="line-520"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927654"><span class="annot"><span class="annottext">k1 :: Type
</span><a href="#local-6989586621680927654"><span class="hs-identifier hs-var hs-var">k1</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927659"><span class="hs-identifier hs-var">tv1</span></a></span><span>
</span><span id="line-521"></span><span>        </span><span id="local-6989586621680927652"><span class="annot"><span class="annottext">k2 :: Type
</span><a href="#local-6989586621680927652"><span class="hs-identifier hs-var hs-var">k2</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927656"><span class="hs-identifier hs-var">tv2</span></a></span><span>
</span><span id="line-522"></span><span>        </span><span id="local-6989586621680927651"><span class="annot"><span class="annottext">eta :: Coercion
</span><a href="#local-6989586621680927651"><span class="hs-identifier hs-var hs-var">eta</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkUnivCo"><span class="hs-identifier hs-var">mkUnivCo</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927654"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927652"><span class="hs-identifier hs-var">k2</span></a></span><span>
</span><span id="line-523"></span><span>          </span><span class="hs-comment">-- eta gets opt'ed soon, but not yet.</span><span>
</span><span id="line-524"></span><span>        </span><span id="local-6989586621680927648"><span class="annot"><span class="annottext">ty2' :: Type
</span><a href="#local-6989586621680927648"><span class="hs-identifier hs-var hs-var">ty2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; [TyCoVar] -&gt; [Type] -&gt; Type -&gt; Type
[TyCoVar] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyWith"><span class="hs-identifier hs-var">substTyWith</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927656"><span class="hs-identifier hs-var">tv2</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-var">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927659"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Coercion -&gt; Type
</span><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-operator hs-var">`mkCastTy`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927651"><span class="hs-identifier hs-var">eta</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927655"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680927644"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927644"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927643"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927643"><span class="hs-identifier hs-var">tv1'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927642"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927642"><span class="hs-identifier hs-var">eta'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool
-&gt; TyCoVar
-&gt; Coercion
-&gt; (LiftingContext, TyCoVar, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#optForAllCoBndr"><span class="hs-identifier hs-var">optForAllCoBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927659"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927651"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-527"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-528"></span><span>    </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkForAllCo"><span class="hs-identifier hs-var">mkForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927643"><span class="hs-identifier hs-var">tv1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927642"><span class="hs-identifier hs-var">eta'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var">opt_univ</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927644"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927658"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927648"><span class="hs-identifier hs-var">ty2'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927641"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927641"><span class="hs-identifier hs-var">cv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927640"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927640"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_co_maybe"><span class="hs-identifier hs-var">splitForAllTy_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927672"><span class="hs-identifier hs-var">oty1</span></a></span><span>
</span><span id="line-531"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927638"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927638"><span class="hs-identifier hs-var">cv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927637"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927637"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_co_maybe"><span class="hs-identifier hs-var">splitForAllTy_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927671"><span class="hs-identifier hs-var">oty2</span></a></span><span>
</span><span id="line-532"></span><span>      </span><span class="hs-comment">-- NB: prov isn't interesting here either</span><span>
</span><span id="line-533"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927636"><span class="annot"><span class="annottext">k1 :: Type
</span><a href="#local-6989586621680927636"><span class="hs-identifier hs-var hs-var">k1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927641"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-534"></span><span>        </span><span id="local-6989586621680927635"><span class="annot"><span class="annottext">k2 :: Type
</span><a href="#local-6989586621680927635"><span class="hs-identifier hs-var hs-var">k2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927638"><span class="hs-identifier hs-var">cv2</span></a></span><span>
</span><span id="line-535"></span><span>        </span><span id="local-6989586621680927634"><span class="annot"><span class="annottext">r' :: Role
</span><a href="#local-6989586621680927634"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Role
</span><a href="GHC.Core.Coercion.html#coVarRole"><span class="hs-identifier hs-var">coVarRole</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927641"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-536"></span><span>        </span><span id="local-6989586621680927633"><span class="annot"><span class="annottext">eta :: Coercion
</span><a href="#local-6989586621680927633"><span class="hs-identifier hs-var hs-var">eta</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkUnivCo"><span class="hs-identifier hs-var">mkUnivCo</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927636"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927635"><span class="hs-identifier hs-var">k2</span></a></span><span>
</span><span id="line-537"></span><span>        </span><span id="local-6989586621680927632"><span class="annot"><span class="annottext">eta_d :: Coercion
</span><a href="#local-6989586621680927632"><span class="hs-identifier hs-var hs-var">eta_d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#downgradeRole"><span class="hs-identifier hs-var">downgradeRole</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927634"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927633"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-538"></span><span>          </span><span class="hs-comment">-- eta gets opt'ed soon, but not yet.</span><span>
</span><span id="line-539"></span><span>        </span><span id="local-6989586621680927629"><span class="annot"><span class="annottext">n_co :: Coercion
</span><a href="#local-6989586621680927629"><span class="hs-identifier hs-var hs-var">n_co</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927634"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927632"><span class="hs-identifier hs-var">eta_d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span>
</span><span id="line-540"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoVarCo"><span class="hs-identifier hs-var">mkCoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927641"><span class="hs-identifier hs-var">cv1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span>
</span><span id="line-541"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927634"><span class="hs-identifier hs-var">r'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927632"><span class="hs-identifier hs-var">eta_d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>        </span><span id="local-6989586621680927627"><span class="annot"><span class="annottext">ty2' :: Type
</span><a href="#local-6989586621680927627"><span class="hs-identifier hs-var hs-var">ty2'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Coercion] -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyWithCoVars"><span class="hs-identifier hs-var">substTyWithCoVars</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927638"><span class="hs-identifier hs-var">cv2</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927629"><span class="hs-identifier hs-var">n_co</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927637"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680927625"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927625"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927624"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927624"><span class="hs-identifier hs-var">cv1'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927623"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927623"><span class="hs-identifier hs-var">eta'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool
-&gt; TyCoVar
-&gt; Coercion
-&gt; (LiftingContext, TyCoVar, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#optForAllCoBndr"><span class="hs-identifier hs-var">optForAllCoBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927641"><span class="hs-identifier hs-var">cv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927633"><span class="hs-identifier hs-var">eta</span></a></span><span>
</span><span id="line-545"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-546"></span><span>    </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkForAllCo"><span class="hs-identifier hs-var">mkForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927624"><span class="hs-identifier hs-var">cv1'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927623"><span class="hs-identifier hs-var">eta'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext
-&gt; Bool -&gt; UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_univ"><span class="hs-identifier hs-var">opt_univ</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927625"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927640"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927627"><span class="hs-identifier hs-var">ty2'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-547"></span><span>
</span><span id="line-548"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927622"><span class="annot"><span class="annottext">ty1 :: Type
</span><a href="#local-6989586621680927622"><span class="hs-identifier hs-var hs-var">ty1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyUnchecked"><span class="hs-identifier hs-var">substTyUnchecked</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcSubstLeft"><span class="hs-identifier hs-var">lcSubstLeft</span></a></span><span>  </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927672"><span class="hs-identifier hs-var">oty1</span></a></span><span>
</span><span id="line-550"></span><span>        </span><span id="local-6989586621680927621"><span class="annot"><span class="annottext">ty2 :: Type
</span><a href="#local-6989586621680927621"><span class="hs-identifier hs-var hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyUnchecked"><span class="hs-identifier hs-var">substTyUnchecked</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; TCvSubst
</span><a href="GHC.Core.Coercion.html#lcSubstRight"><span class="hs-identifier hs-var">lcSubstRight</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927671"><span class="hs-identifier hs-var">oty2</span></a></span><span>
</span><span id="line-551"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680927620"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927620"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927619"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927619"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927621"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927622"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-552"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927622"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927621"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-553"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-554"></span><span>    </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkUnivCo"><span class="hs-identifier hs-var">mkUnivCo</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927673"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927620"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927619"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-557"></span><span>    </span><span id="local-6989586621680927661"><span class="annot"><span class="annottext">prov' :: UnivCoProvenance
</span><a href="#local-6989586621680927661"><span class="hs-identifier hs-var hs-var">prov'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927674"><span class="hs-identifier hs-var">prov</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-558"></span><span>      </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-type">PhantomProv</span></a></span><span> </span><span id="local-6989586621680927618"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927618"><span class="hs-identifier hs-var">kco</span></a></span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-var">PhantomProv</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; UnivCoProvenance) -&gt; Coercion -&gt; UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927618"><span class="hs-identifier hs-var">kco</span></a></span><span>
</span><span id="line-559"></span><span>      </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ProofIrrelProv"><span class="hs-identifier hs-type">ProofIrrelProv</span></a></span><span> </span><span id="local-6989586621680927616"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927616"><span class="hs-identifier hs-var">kco</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#ProofIrrelProv"><span class="hs-identifier hs-var">ProofIrrelProv</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; UnivCoProvenance) -&gt; Coercion -&gt; UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927676"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927675"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927616"><span class="hs-identifier hs-var">kco</span></a></span><span>
</span><span id="line-560"></span><span>      </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PluginProv"><span class="hs-identifier hs-type">PluginProv</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927674"><span class="hs-identifier hs-var">prov</span></a></span><span>
</span><span id="line-561"></span><span>      </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#CorePrepProv"><span class="hs-identifier hs-var">CorePrepProv</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927674"><span class="hs-identifier hs-var">prov</span></a></span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-comment">-------------</span><span>
</span><span id="line-564"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-type">opt_transList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-565"></span><span id="opt_transList"><span class="annot"><span class="annottext">opt_transList :: HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var hs-var">opt_transList</span></a></span></span><span> </span><span id="local-6989586621680927611"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927611"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; (Coercion -&gt; Coercion -&gt; Coercion)
-&gt; [Coercion]
-&gt; [Coercion]
-&gt; [Coercion]
forall a b c. String -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-var">zipWithEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;opt_transList&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927611"><span class="hs-identifier hs-var">is</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>  </span><span class="hs-comment">-- The input lists must have identical length.</span><span>
</span><span id="line-567"></span><span>
</span><span id="line-568"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-type">opt_trans</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-569"></span><span id="opt_trans"><span class="annot"><span class="annottext">opt_trans :: InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var hs-var">opt_trans</span></a></span></span><span> </span><span id="local-6989586621680927609"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927609"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927608"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927608"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927607"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927607"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-570"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927608"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927607"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-571"></span><span>    </span><span class="hs-comment">-- optimize when co1 is a Refl Co</span><span>
</span><span id="line-572"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans1"><span class="hs-identifier hs-var">opt_trans1</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927609"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927608"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927607"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-573"></span><span>
</span><span id="line-574"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans1"><span class="hs-identifier hs-type">opt_trans1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-type">NormalNonIdCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-575"></span><span class="hs-comment">-- First arg is not the identity</span><span>
</span><span id="line-576"></span><span id="opt_trans1"><span class="annot"><span class="annottext">opt_trans1 :: InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans1"><span class="hs-identifier hs-var hs-var">opt_trans1</span></a></span></span><span> </span><span id="local-6989586621680927604"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927604"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927603"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927603"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927602"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927602"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-577"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927602"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927603"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-578"></span><span>    </span><span class="hs-comment">-- optimize when co2 is a Refl Co</span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-var">opt_trans2</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927604"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927603"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927602"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-580"></span><span>
</span><span id="line-581"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-type">opt_trans2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-type">NormalNonIdCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-type">NormalNonIdCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-582"></span><span class="hs-comment">-- Neither arg is the identity</span><span>
</span><span id="line-583"></span><span id="opt_trans2"><span class="annot"><span class="annottext">opt_trans2 :: InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-var hs-var">opt_trans2</span></a></span></span><span> </span><span id="local-6989586621680927600"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927600"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TransCo"><span class="hs-identifier hs-type">TransCo</span></a></span><span> </span><span id="local-6989586621680927599"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927599"><span class="hs-identifier hs-var">co1a</span></a></span></span><span> </span><span id="local-6989586621680927598"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927598"><span class="hs-identifier hs-var">co1b</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927597"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927597"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-584"></span><span>    </span><span class="hs-comment">-- Don't know whether the sub-coercions are the identity</span><span>
</span><span id="line-585"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927600"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927599"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927600"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927598"><span class="hs-identifier hs-var">co1b</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927597"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-var">opt_trans2</span></a></span><span> </span><span id="local-6989586621680927596"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927596"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927595"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927595"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927594"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927594"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-588"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927593"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927593"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927596"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927595"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927594"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-589"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927593"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-590"></span><span>
</span><span id="line-591"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-var">opt_trans2</span></a></span><span> </span><span id="local-6989586621680927591"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927591"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927590"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927590"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TransCo"><span class="hs-identifier hs-type">TransCo</span></a></span><span> </span><span id="local-6989586621680927589"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927589"><span class="hs-identifier hs-var">co2a</span></a></span></span><span> </span><span id="local-6989586621680927588"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927588"><span class="hs-identifier hs-var">co2b</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927587"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927587"><span class="hs-identifier hs-var">co1_2a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927591"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927590"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927589"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-593"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927587"><span class="hs-identifier hs-var">co1_2a</span></a></span><span>
</span><span id="line-594"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927588"><span class="hs-identifier hs-var">co2b</span></a></span><span>
</span><span id="line-595"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans1"><span class="hs-identifier hs-var">opt_trans1</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927591"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927587"><span class="hs-identifier hs-var">co1_2a</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927588"><span class="hs-identifier hs-var">co2b</span></a></span><span>
</span><span id="line-596"></span><span>
</span><span id="line-597"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans2"><span class="hs-identifier hs-var">opt_trans2</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927586"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927586"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927585"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927585"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-598"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-identifier hs-var">mkTransCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927586"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927585"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-599"></span><span>
</span><span id="line-600"></span><span class="hs-comment">------</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- Optimize coercions with a top-level use of transitivity.</span><span>
</span><span id="line-602"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-type">opt_trans_rule</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-type">NormalNonIdCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalNonIdCo"><span class="hs-identifier hs-type">NormalNonIdCo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#NormalCo"><span class="hs-identifier hs-type">NormalCo</span></a></span><span>
</span><span id="line-603"></span><span>
</span><span id="line-604"></span><span id="opt_trans_rule"><span class="annot"><span class="annottext">opt_trans_rule :: InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var hs-var">opt_trans_rule</span></a></span></span><span> </span><span id="local-6989586621680927584"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927584"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927583"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927583"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#GRefl"><span class="hs-identifier hs-type">GRefl</span></a></span><span> </span><span id="local-6989586621680927582"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927582"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927581"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927581"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-type">MCo</span></a></span><span> </span><span id="local-6989586621680927580"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927580"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927579"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927579"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#GRefl"><span class="hs-identifier hs-type">GRefl</span></a></span><span> </span><span id="local-6989586621680927578"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927578"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-type">MCo</span></a></span><span> </span><span id="local-6989586621680927577"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927577"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-605"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GRefl&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927583"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927579"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-607"></span><span>    </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkGReflRightCo"><span class="hs-identifier hs-var">mkGReflRightCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927582"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927581"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927584"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927580"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927577"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-608"></span><span>
</span><span id="line-609"></span><span class="hs-comment">-- Push transitivity through matching destructors</span><span>
</span><span id="line-610"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927574"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927574"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927573"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927573"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927572"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927572"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927571"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927571"><span class="hs-identifier hs-var">d1</span></a></span></span><span> </span><span id="local-6989586621680927570"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927570"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927569"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927569"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NthCo"><span class="hs-identifier hs-type">NthCo</span></a></span><span> </span><span id="local-6989586621680927568"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927568"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span id="local-6989586621680927567"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927567"><span class="hs-identifier hs-var">d2</span></a></span></span><span> </span><span id="local-6989586621680927566"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927566"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-611"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927571"><span class="hs-identifier hs-var">d1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927567"><span class="hs-identifier hs-var">d2</span></a></span><span>
</span><span id="line-612"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927570"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927566"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927570"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.Opt.html#compatible_co"><span class="hs-operator hs-var">`compatible_co`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927566"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-614"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-615"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PushNth&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927573"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927569"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-616"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927572"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927571"><span class="hs-identifier hs-var">d1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927574"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927570"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927566"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-617"></span><span>
</span><span id="line-618"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927564"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927564"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927563"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927563"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-type">LRCo</span></a></span><span> </span><span id="local-6989586621680927562"><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927562"><span class="hs-identifier hs-var">d1</span></a></span></span><span> </span><span id="local-6989586621680927561"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927561"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927560"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927560"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-type">LRCo</span></a></span><span> </span><span id="local-6989586621680927559"><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927559"><span class="hs-identifier hs-var">d2</span></a></span></span><span> </span><span id="local-6989586621680927558"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927558"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-619"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927562"><span class="hs-identifier hs-var">d1</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight -&gt; LeftOrRight -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927559"><span class="hs-identifier hs-var">d2</span></a></span><span>
</span><span id="line-620"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927561"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.Opt.html#compatible_co"><span class="hs-operator hs-var">`compatible_co`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927558"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-621"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PushLR&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927563"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927560"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-622"></span><span>    </span><span class="annot"><span class="annottext">LeftOrRight -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkLRCo"><span class="hs-identifier hs-var">mkLRCo</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="#local-6989586621680927562"><span class="hs-identifier hs-var">d1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927564"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927561"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927558"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span class="hs-comment">-- Push transitivity inside instantiation</span><span>
</span><span id="line-625"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927556"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927556"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927555"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927555"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#InstCo"><span class="hs-identifier hs-type">InstCo</span></a></span><span> </span><span id="local-6989586621680927554"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927554"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927553"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927553"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927552"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927552"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#InstCo"><span class="hs-identifier hs-type">InstCo</span></a></span><span> </span><span id="local-6989586621680927551"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927551"><span class="hs-identifier hs-var">co2</span></a></span></span><span> </span><span id="local-6989586621680927550"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927550"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-626"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927553"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.html#eqCoercion"><span class="hs-operator hs-var">`eqCoercion`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927550"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-627"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927554"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.Opt.html#compatible_co"><span class="hs-operator hs-var">`compatible_co`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927551"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-628"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushInst&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927555"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927552"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-629"></span><span>    </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927556"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927554"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927551"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927553"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927547"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927547"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927546"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927546"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#UnivCo"><span class="hs-identifier hs-type">UnivCo</span></a></span><span> </span><span id="local-6989586621680927545"><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927545"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span id="local-6989586621680927544"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927544"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927543"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927543"><span class="hs-identifier hs-var">tyl1</span></a></span></span><span> </span><span id="local-6989586621680927542"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927542"><span class="hs-identifier hs-var">_tyr1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-632"></span><span>                  </span><span id="local-6989586621680927541"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927541"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#UnivCo"><span class="hs-identifier hs-type">UnivCo</span></a></span><span> </span><span id="local-6989586621680927540"><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927540"><span class="hs-identifier hs-var">p2</span></a></span></span><span> </span><span id="local-6989586621680927539"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927539"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span id="local-6989586621680927538"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927538"><span class="hs-identifier hs-var">_tyl2</span></a></span></span><span> </span><span id="local-6989586621680927537"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927537"><span class="hs-identifier hs-var">tyr2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-633"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927536"><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927536"><span class="hs-identifier hs-var">prov'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; UnivCoProvenance -&gt; Maybe UnivCoProvenance
</span><a href="#local-6989586621680927535"><span class="hs-identifier hs-var">opt_trans_prov</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927545"><span class="hs-identifier hs-var">p1</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927540"><span class="hs-identifier hs-var">p2</span></a></span><span>
</span><span id="line-634"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-635"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UnivCo&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927546"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927541"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-636"></span><span>    </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Role -&gt; Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkUnivCo"><span class="hs-identifier hs-var">mkUnivCo</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927536"><span class="hs-identifier hs-var">prov'</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927544"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927543"><span class="hs-identifier hs-var">tyl1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927537"><span class="hs-identifier hs-var">tyr2</span></a></span><span>
</span><span id="line-637"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-638"></span><span>    </span><span class="hs-comment">-- if the provenances are different, opt'ing will be very confusing</span><span>
</span><span id="line-639"></span><span>    </span><span id="local-6989586621680927535"><span class="annot"><span class="annottext">opt_trans_prov :: UnivCoProvenance -&gt; UnivCoProvenance -&gt; Maybe UnivCoProvenance
</span><a href="#local-6989586621680927535"><span class="hs-identifier hs-var hs-var">opt_trans_prov</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-type">PhantomProv</span></a></span><span> </span><span id="local-6989586621680927530"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927530"><span class="hs-identifier hs-var">kco1</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-type">PhantomProv</span></a></span><span> </span><span id="local-6989586621680927529"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927529"><span class="hs-identifier hs-var">kco2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-640"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Maybe UnivCoProvenance
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(UnivCoProvenance -&gt; Maybe UnivCoProvenance)
-&gt; UnivCoProvenance -&gt; Maybe UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#PhantomProv"><span class="hs-identifier hs-var">PhantomProv</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; UnivCoProvenance) -&gt; Coercion -&gt; UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927547"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927530"><span class="hs-identifier hs-var">kco1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927529"><span class="hs-identifier hs-var">kco2</span></a></span><span>
</span><span id="line-641"></span><span>    </span><span class="annot"><a href="#local-6989586621680927535"><span class="hs-identifier hs-var">opt_trans_prov</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ProofIrrelProv"><span class="hs-identifier hs-type">ProofIrrelProv</span></a></span><span> </span><span id="local-6989586621680927528"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927528"><span class="hs-identifier hs-var">kco1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ProofIrrelProv"><span class="hs-identifier hs-type">ProofIrrelProv</span></a></span><span> </span><span id="local-6989586621680927527"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927527"><span class="hs-identifier hs-var">kco2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-642"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Maybe UnivCoProvenance
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(UnivCoProvenance -&gt; Maybe UnivCoProvenance)
-&gt; UnivCoProvenance -&gt; Maybe UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; UnivCoProvenance
</span><a href="GHC.Core.TyCo.Rep.html#ProofIrrelProv"><span class="hs-identifier hs-var">ProofIrrelProv</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; UnivCoProvenance) -&gt; Coercion -&gt; UnivCoProvenance
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927547"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927528"><span class="hs-identifier hs-var">kco1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927527"><span class="hs-identifier hs-var">kco2</span></a></span><span>
</span><span id="line-643"></span><span>    </span><span class="annot"><a href="#local-6989586621680927535"><span class="hs-identifier hs-var">opt_trans_prov</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PluginProv"><span class="hs-identifier hs-type">PluginProv</span></a></span><span> </span><span id="local-6989586621680927526"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680927526"><span class="hs-identifier hs-var">str1</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PluginProv"><span class="hs-identifier hs-type">PluginProv</span></a></span><span> </span><span id="local-6989586621680927525"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680927525"><span class="hs-identifier hs-var">str2</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680927526"><span class="hs-identifier hs-var">str1</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680927525"><span class="hs-identifier hs-var">str2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance -&gt; Maybe UnivCoProvenance
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><a href="#local-6989586621680927545"><span class="hs-identifier hs-var">p1</span></a></span><span>
</span><span id="line-644"></span><span>    </span><span class="annot"><a href="#local-6989586621680927535"><span class="hs-identifier hs-var">opt_trans_prov</span></a></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UnivCoProvenance
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe UnivCoProvenance
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span class="hs-comment">-- Push transitivity down through matching top-level constructors.</span><span>
</span><span id="line-647"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927524"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927524"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927523"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927523"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span id="local-6989586621680927522"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927522"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927521"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927521"><span class="hs-identifier hs-var">tc1</span></a></span></span><span> </span><span id="local-6989586621680927520"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927520"><span class="hs-identifier hs-var">cos1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927519"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927519"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span id="local-6989586621680927518"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927518"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span id="local-6989586621680927517"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927517"><span class="hs-identifier hs-var">tc2</span></a></span></span><span> </span><span id="local-6989586621680927516"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927516"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-648"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927521"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927517"><span class="hs-identifier hs-var">tc2</span></a></span><span>
</span><span id="line-649"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-650"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PushTyConApp&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927523"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927519"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-651"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927522"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927521"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927524"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927520"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927516"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927515"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927515"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927514"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927514"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunCo"><span class="hs-identifier hs-type">FunCo</span></a></span><span> </span><span id="local-6989586621680927513"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927513"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927512"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927512"><span class="hs-identifier hs-var">w1</span></a></span></span><span> </span><span id="local-6989586621680927511"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927511"><span class="hs-identifier hs-var">co1a</span></a></span></span><span> </span><span id="local-6989586621680927510"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927510"><span class="hs-identifier hs-var">co1b</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927509"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927509"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunCo"><span class="hs-identifier hs-type">FunCo</span></a></span><span> </span><span id="local-6989586621680927508"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927508"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span id="local-6989586621680927507"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927507"><span class="hs-identifier hs-var">w2</span></a></span></span><span> </span><span id="local-6989586621680927506"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927506"><span class="hs-identifier hs-var">co2a</span></a></span></span><span> </span><span id="local-6989586621680927505"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927505"><span class="hs-identifier hs-var">co2b</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-654"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">r1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">r2</span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Just like the TyConAppCo/TyConAppCo case</span><span>
</span><span id="line-655"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PushFun&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927514"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927509"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-656"></span><span>    </span><span class="annot"><span class="annottext">Role -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkFunCo"><span class="hs-identifier hs-var">mkFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927513"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927515"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927512"><span class="hs-identifier hs-var">w1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927507"><span class="hs-identifier hs-var">w2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927515"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927511"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927506"><span class="hs-identifier hs-var">co2a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927515"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927510"><span class="hs-identifier hs-var">co1b</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927505"><span class="hs-identifier hs-var">co2b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927504"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927504"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927503"><span class="annot"><span class="annottext">in_co1 :: Coercion
</span><a href="#local-6989586621680927503"><span class="hs-identifier hs-var">in_co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927502"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927502"><span class="hs-identifier hs-var">co1a</span></a></span></span><span> </span><span id="local-6989586621680927501"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927501"><span class="hs-identifier hs-var">co1b</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927500"><span class="annot"><span class="annottext">in_co2 :: Coercion
</span><a href="#local-6989586621680927500"><span class="hs-identifier hs-var">in_co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927499"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927499"><span class="hs-identifier hs-var">co2a</span></a></span></span><span> </span><span id="local-6989586621680927498"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927498"><span class="hs-identifier hs-var">co2b</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-659"></span><span>  </span><span class="hs-comment">-- Must call opt_trans_rule_app; see Note [EtaAppCo]</span><span>
</span><span id="line-660"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var">opt_trans_rule_app</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927504"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927503"><span class="hs-identifier hs-var">in_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927500"><span class="hs-identifier hs-var">in_co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927502"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927501"><span class="hs-identifier hs-var">co1b</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927499"><span class="hs-identifier hs-var">co2a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927498"><span class="hs-identifier hs-var">co2b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span class="hs-comment">-- Eta rules</span><span>
</span><span id="line-663"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927496"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927496"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927495"><span class="annot"><span class="annottext">co1 :: Coercion
</span><a href="#local-6989586621680927495"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span id="local-6989586621680927494"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927494"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621680927493"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927493"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680927492"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927492"><span class="hs-identifier hs-var">cos1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927491"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927491"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927490"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927490"><span class="hs-identifier hs-var">cos2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#etaTyConAppCo_maybe"><span class="hs-identifier hs-var">etaTyConAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927493"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927491"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-665"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;EtaCompL&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927495"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927491"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-666"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927494"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927493"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927496"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927492"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927490"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-667"></span><span>
</span><span id="line-668"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927488"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927488"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927487"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927487"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927486"><span class="annot"><span class="annottext">co2 :: Coercion
</span><a href="#local-6989586621680927486"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span id="local-6989586621680927485"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927485"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621680927484"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927484"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680927483"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927483"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-669"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927482"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927482"><span class="hs-identifier hs-var">cos1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#etaTyConAppCo_maybe"><span class="hs-identifier hs-var">etaTyConAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927484"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927487"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-670"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;EtaCompR&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927487"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927486"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-671"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
Role -&gt; TyCon -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTyConAppCo"><span class="hs-identifier hs-var">mkTyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927485"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927484"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927488"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927482"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927483"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927481"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927481"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927480"><span class="annot"><span class="annottext">co1 :: Coercion
</span><a href="#local-6989586621680927480"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927479"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927479"><span class="hs-identifier hs-var">co1a</span></a></span></span><span> </span><span id="local-6989586621680927478"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927478"><span class="hs-identifier hs-var">co1b</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927477"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927477"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-674"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927476"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927476"><span class="hs-identifier hs-var">co2a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680927475"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927475"><span class="hs-identifier hs-var">co2b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-var">etaAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927477"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-675"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var">opt_trans_rule_app</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927481"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927480"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927477"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927479"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927478"><span class="hs-identifier hs-var">co1b</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927476"><span class="hs-identifier hs-var">co2a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927475"><span class="hs-identifier hs-var">co2b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927473"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927473"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927472"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927472"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927471"><span class="annot"><span class="annottext">co2 :: Coercion
</span><a href="#local-6989586621680927471"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927470"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927470"><span class="hs-identifier hs-var">co2a</span></a></span></span><span> </span><span id="local-6989586621680927469"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927469"><span class="hs-identifier hs-var">co2b</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-678"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927468"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927468"><span class="hs-identifier hs-var">co1a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680927467"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927467"><span class="hs-identifier hs-var">co1b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-var">etaAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927472"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-679"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var">opt_trans_rule_app</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927473"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927472"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927471"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927468"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927467"><span class="hs-identifier hs-var">co1b</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927470"><span class="hs-identifier hs-var">co2a</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927469"><span class="hs-identifier hs-var">co2b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span class="hs-comment">-- Push transitivity inside forall</span><span>
</span><span id="line-682"></span><span class="hs-comment">-- forall over types.</span><span>
</span><span id="line-683"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927466"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927466"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927465"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927465"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927464"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927464"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-684"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927463"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927463"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927462"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927462"><span class="hs-identifier hs-var">eta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927461"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927461"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_ty_maybe"><span class="hs-identifier hs-var">splitForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927465"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-685"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927460"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927460"><span class="hs-identifier hs-var">tv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927459"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927459"><span class="hs-identifier hs-var">eta2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927458"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927458"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_ty_maybe"><span class="hs-identifier hs-var">etaForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927464"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-686"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927456"><span class="hs-identifier hs-var">push_trans</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927463"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927462"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927461"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927460"><span class="hs-identifier hs-var">tv2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927459"><span class="hs-identifier hs-var">eta2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927458"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-687"></span><span>
</span><span id="line-688"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927455"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927455"><span class="hs-identifier hs-var">tv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927454"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927454"><span class="hs-identifier hs-var">eta2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927453"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927453"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_ty_maybe"><span class="hs-identifier hs-var">splitForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927464"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-689"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927452"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927452"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927451"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927451"><span class="hs-identifier hs-var">eta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927450"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927450"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_ty_maybe"><span class="hs-identifier hs-var">etaForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927465"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-690"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927456"><span class="hs-identifier hs-var">push_trans</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927452"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927451"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927450"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927455"><span class="hs-identifier hs-var">tv2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927454"><span class="hs-identifier hs-var">eta2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927453"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-691"></span><span>
</span><span id="line-692"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-693"></span><span>  </span><span id="local-6989586621680927456"><span class="annot"><span class="annottext">push_trans :: TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927456"><span class="hs-identifier hs-var hs-var">push_trans</span></a></span></span><span> </span><span id="local-6989586621680927449"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927449"><span class="hs-identifier hs-var">tv1</span></a></span></span><span> </span><span id="local-6989586621680927448"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927448"><span class="hs-identifier hs-var">eta1</span></a></span></span><span> </span><span id="local-6989586621680927447"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927447"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927446"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927446"><span class="hs-identifier hs-var">tv2</span></a></span></span><span> </span><span id="local-6989586621680927445"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927445"><span class="hs-identifier hs-var">eta2</span></a></span></span><span> </span><span id="local-6989586621680927444"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927444"><span class="hs-identifier hs-var">r2</span></a></span></span><span>
</span><span id="line-694"></span><span>    </span><span class="hs-comment">-- Given:</span><span>
</span><span id="line-695"></span><span>    </span><span class="hs-comment">--   co1 = /\ tv1 : eta1. r1</span><span>
</span><span id="line-696"></span><span>    </span><span class="hs-comment">--   co2 = /\ tv2 : eta2. r2</span><span>
</span><span id="line-697"></span><span>    </span><span class="hs-comment">-- Wanted:</span><span>
</span><span id="line-698"></span><span>    </span><span class="hs-comment">--   /\tv1 : (eta1;eta2).  (r1; r2[tv2 |-&gt; tv1 |&gt; eta1])</span><span>
</span><span id="line-699"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;EtaAllTy_ty&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927465"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927464"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-700"></span><span>      </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkForAllCo"><span class="hs-identifier hs-var">mkForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927449"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927466"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927448"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927445"><span class="hs-identifier hs-var">eta2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927443"><span class="hs-identifier hs-var">is'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927447"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927442"><span class="hs-identifier hs-var">r2'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-701"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-702"></span><span>      </span><span id="local-6989586621680927443"><span class="annot"><span class="annottext">is' :: InScopeSet
</span><a href="#local-6989586621680927443"><span class="hs-identifier hs-var hs-var">is'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927466"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; TyCoVar -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#extendInScopeSet"><span class="hs-operator hs-var">`extendInScopeSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927449"><span class="hs-identifier hs-var">tv1</span></a></span><span>
</span><span id="line-703"></span><span>      </span><span id="local-6989586621680927442"><span class="annot"><span class="annottext">r2' :: Coercion
</span><a href="#local-6989586621680927442"><span class="hs-identifier hs-var hs-var">r2'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Type] -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Subst.html#substCoWithUnchecked"><span class="hs-identifier hs-var">substCoWithUnchecked</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927446"><span class="hs-identifier hs-var">tv2</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type -&gt; Coercion -&gt; Type
</span><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-identifier hs-var">mkCastTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-var">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927449"><span class="hs-identifier hs-var">tv1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927448"><span class="hs-identifier hs-var">eta1</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927444"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-704"></span><span>
</span><span id="line-705"></span><span class="hs-comment">-- Push transitivity inside forall</span><span>
</span><span id="line-706"></span><span class="hs-comment">-- forall over coercions.</span><span>
</span><span id="line-707"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927439"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927439"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927438"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927438"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927437"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927437"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-708"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927436"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927436"><span class="hs-identifier hs-var">cv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927435"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927435"><span class="hs-identifier hs-var">eta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927434"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927434"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_co_maybe"><span class="hs-identifier hs-var">splitForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927438"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-709"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927433"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927433"><span class="hs-identifier hs-var">cv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927432"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927432"><span class="hs-identifier hs-var">eta2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927431"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927431"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_co_maybe"><span class="hs-identifier hs-var">etaForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927437"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-710"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927429"><span class="hs-identifier hs-var">push_trans</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927436"><span class="hs-identifier hs-var">cv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927435"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927434"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927433"><span class="hs-identifier hs-var">cv2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927432"><span class="hs-identifier hs-var">eta2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927431"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927428"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927428"><span class="hs-identifier hs-var">cv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927427"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927427"><span class="hs-identifier hs-var">eta2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927426"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927426"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_co_maybe"><span class="hs-identifier hs-var">splitForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927437"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-713"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927425"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927425"><span class="hs-identifier hs-var">cv1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927424"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927424"><span class="hs-identifier hs-var">eta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927423"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927423"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_co_maybe"><span class="hs-identifier hs-var">etaForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927438"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-714"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927429"><span class="hs-identifier hs-var">push_trans</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927425"><span class="hs-identifier hs-var">cv1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927424"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927423"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927428"><span class="hs-identifier hs-var">cv2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927427"><span class="hs-identifier hs-var">eta2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927426"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-715"></span><span>
</span><span id="line-716"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-717"></span><span>  </span><span id="local-6989586621680927429"><span class="annot"><span class="annottext">push_trans :: TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; TyCoVar
-&gt; Coercion
-&gt; Coercion
-&gt; Maybe Coercion
</span><a href="#local-6989586621680927429"><span class="hs-identifier hs-var hs-var">push_trans</span></a></span></span><span> </span><span id="local-6989586621680927422"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927422"><span class="hs-identifier hs-var">cv1</span></a></span></span><span> </span><span id="local-6989586621680927421"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927421"><span class="hs-identifier hs-var">eta1</span></a></span></span><span> </span><span id="local-6989586621680927420"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927420"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span id="local-6989586621680927419"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927419"><span class="hs-identifier hs-var">cv2</span></a></span></span><span> </span><span id="local-6989586621680927418"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927418"><span class="hs-identifier hs-var">eta2</span></a></span></span><span> </span><span id="local-6989586621680927417"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927417"><span class="hs-identifier hs-var">r2</span></a></span></span><span>
</span><span id="line-718"></span><span>    </span><span class="hs-comment">-- Given:</span><span>
</span><span id="line-719"></span><span>    </span><span class="hs-comment">--   co1 = /\ cv1 : eta1. r1</span><span>
</span><span id="line-720"></span><span>    </span><span class="hs-comment">--   co2 = /\ cv2 : eta2. r2</span><span>
</span><span id="line-721"></span><span>    </span><span class="hs-comment">-- Wanted:</span><span>
</span><span id="line-722"></span><span>    </span><span class="hs-comment">--   n1 = nth 2 eta1</span><span>
</span><span id="line-723"></span><span>    </span><span class="hs-comment">--   n2 = nth 3 eta1</span><span>
</span><span id="line-724"></span><span>    </span><span class="hs-comment">--   nco = /\ cv1 : (eta1;eta2). (r1; r2[cv2 |-&gt; (sym n1);cv1;n2])</span><span>
</span><span id="line-725"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;EtaAllTy_co&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927438"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927437"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-726"></span><span>      </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkForAllCo"><span class="hs-identifier hs-var">mkForAllCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927422"><span class="hs-identifier hs-var">cv1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927439"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927421"><span class="hs-identifier hs-var">eta1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927418"><span class="hs-identifier hs-var">eta2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927416"><span class="hs-identifier hs-var">is'</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927420"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927415"><span class="hs-identifier hs-var">r2'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-727"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-728"></span><span>      </span><span id="local-6989586621680927416"><span class="annot"><span class="annottext">is' :: InScopeSet
</span><a href="#local-6989586621680927416"><span class="hs-identifier hs-var hs-var">is'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927439"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; TyCoVar -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#extendInScopeSet"><span class="hs-operator hs-var">`extendInScopeSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927422"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-729"></span><span>      </span><span id="local-6989586621680927414"><span class="annot"><span class="annottext">role :: Role
</span><a href="#local-6989586621680927414"><span class="hs-keyword hs-var hs-var">role</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Role
</span><a href="GHC.Core.Coercion.html#coVarRole"><span class="hs-identifier hs-var">coVarRole</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927422"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-730"></span><span>      </span><span id="local-6989586621680927413"><span class="annot"><span class="annottext">eta1' :: Coercion
</span><a href="#local-6989586621680927413"><span class="hs-identifier hs-var hs-var">eta1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#downgradeRole"><span class="hs-identifier hs-var">downgradeRole</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927414"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927421"><span class="hs-identifier hs-var">eta1</span></a></span><span>
</span><span id="line-731"></span><span>      </span><span id="local-6989586621680927411"><span class="annot"><span class="annottext">n1 :: Coercion
</span><a href="#local-6989586621680927411"><span class="hs-identifier hs-var hs-var">n1</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927414"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927413"><span class="hs-identifier hs-var">eta1'</span></a></span><span>
</span><span id="line-732"></span><span>      </span><span id="local-6989586621680927409"><span class="annot"><span class="annottext">n2 :: Coercion
</span><a href="#local-6989586621680927409"><span class="hs-identifier hs-var hs-var">n2</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927414"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927413"><span class="hs-identifier hs-var">eta1'</span></a></span><span>
</span><span id="line-733"></span><span>      </span><span id="local-6989586621680927415"><span class="annot"><span class="annottext">r2' :: Coercion
</span><a href="#local-6989586621680927415"><span class="hs-identifier hs-var hs-var">r2'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Coercion -&gt; Coercion
TCvSubst -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Subst.html#substCo"><span class="hs-identifier hs-var">substCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Coercion] -&gt; TCvSubst
HasDebugCallStack =&gt; [TyCoVar] -&gt; [Coercion] -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipCvSubst"><span class="hs-identifier hs-var">zipCvSubst</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927419"><span class="hs-identifier hs-var">cv2</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927411"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span>
</span><span id="line-734"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoVarCo"><span class="hs-identifier hs-var">mkCoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927422"><span class="hs-identifier hs-var">cv1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927409"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-735"></span><span>                    </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927417"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-736"></span><span>
</span><span id="line-737"></span><span class="hs-comment">-- Push transitivity inside axioms</span><span>
</span><span id="line-738"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span id="local-6989586621680927404"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927403"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927402"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-739"></span><span>
</span><span id="line-740"></span><span>  </span><span class="hs-comment">-- See Note [Why call checkAxInstCo during optimisation]</span><span>
</span><span id="line-741"></span><span>  </span><span class="hs-comment">-- TrPushSymAxR</span><span>
</span><span id="line-742"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927401"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927401"><span class="hs-identifier hs-var">sym</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927400"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927400"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927399"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927399"><span class="hs-identifier hs-var">ind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927398"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927398"><span class="hs-identifier hs-var">cos1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927397"><span class="hs-identifier hs-var">co1_is_axiom_maybe</span></a></span><span>
</span><span id="line-743"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927401"><span class="hs-identifier hs-var">sym</span></a></span><span>
</span><span id="line-744"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927396"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927396"><span class="hs-identifier hs-var">cos2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CoAxiom Branched -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
forall (br :: BranchFlag).
Bool -&gt; CoAxiom br -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-var">matchAxiom</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927401"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927400"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927399"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-745"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927393"><span class="annot"><span class="annottext">newAxInst :: Coercion
</span><a href="#local-6989586621680927393"><span class="hs-identifier hs-var hs-var">newAxInst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-var">AxiomInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927400"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927399"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927396"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927398"><span class="hs-identifier hs-var">cos1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-746"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe CoAxBranch
</span><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var">checkAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927393"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-747"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushSymAxR&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#SymCo"><span class="hs-identifier hs-var">SymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927393"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-748"></span><span>
</span><span id="line-749"></span><span>  </span><span class="hs-comment">-- TrPushAxR</span><span>
</span><span id="line-750"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927392"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927392"><span class="hs-identifier hs-var">sym</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927391"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927391"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927390"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927390"><span class="hs-identifier hs-var">ind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927389"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927389"><span class="hs-identifier hs-var">cos1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927397"><span class="hs-identifier hs-var">co1_is_axiom_maybe</span></a></span><span>
</span><span id="line-751"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927392"><span class="hs-identifier hs-var">sym</span></a></span><span>
</span><span id="line-752"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927388"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927388"><span class="hs-identifier hs-var">cos2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CoAxiom Branched -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
forall (br :: BranchFlag).
Bool -&gt; CoAxiom br -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-var">matchAxiom</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927392"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927391"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927390"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-753"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927386"><span class="annot"><span class="annottext">newAxInst :: Coercion
</span><a href="#local-6989586621680927386"><span class="hs-identifier hs-var hs-var">newAxInst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-var">AxiomInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927391"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927390"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927389"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927388"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-754"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe CoAxBranch
</span><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var">checkAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927386"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-755"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushAxR&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927386"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-756"></span><span>
</span><span id="line-757"></span><span>  </span><span class="hs-comment">-- TrPushSymAxL</span><span>
</span><span id="line-758"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927385"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927385"><span class="hs-identifier hs-var">sym</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927384"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927384"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927383"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927383"><span class="hs-identifier hs-var">ind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927382"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927382"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927381"><span class="hs-identifier hs-var">co2_is_axiom_maybe</span></a></span><span>
</span><span id="line-759"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927385"><span class="hs-identifier hs-var">sym</span></a></span><span>
</span><span id="line-760"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927380"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927380"><span class="hs-identifier hs-var">cos1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CoAxiom Branched -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
forall (br :: BranchFlag).
Bool -&gt; CoAxiom br -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-var">matchAxiom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927385"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927384"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927383"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-761"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927378"><span class="annot"><span class="annottext">newAxInst :: Coercion
</span><a href="#local-6989586621680927378"><span class="hs-identifier hs-var hs-var">newAxInst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-var">AxiomInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927384"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927383"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927382"><span class="hs-identifier hs-var">cos2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927380"><span class="hs-identifier hs-var">cos1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-762"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe CoAxBranch
</span><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var">checkAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927378"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-763"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushSymAxL&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#SymCo"><span class="hs-identifier hs-var">SymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927378"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-764"></span><span>
</span><span id="line-765"></span><span>  </span><span class="hs-comment">-- TrPushAxL</span><span>
</span><span id="line-766"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927377"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927377"><span class="hs-identifier hs-var">sym</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927376"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927376"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927375"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927375"><span class="hs-identifier hs-var">ind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927374"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927374"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927381"><span class="hs-identifier hs-var">co2_is_axiom_maybe</span></a></span><span>
</span><span id="line-767"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927377"><span class="hs-identifier hs-var">sym</span></a></span><span>
</span><span id="line-768"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927373"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927373"><span class="hs-identifier hs-var">cos1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CoAxiom Branched -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
forall (br :: BranchFlag).
Bool -&gt; CoAxiom br -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-var">matchAxiom</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927377"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927376"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927375"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-769"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927371"><span class="annot"><span class="annottext">newAxInst :: Coercion
</span><a href="#local-6989586621680927371"><span class="hs-identifier hs-var hs-var">newAxInst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-var">AxiomInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927376"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927375"><span class="hs-identifier hs-var">ind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927373"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927374"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-770"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe CoAxBranch
</span><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var">checkAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927371"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-771"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushAxL&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927371"><span class="hs-identifier hs-var">newAxInst</span></a></span><span>
</span><span id="line-772"></span><span>
</span><span id="line-773"></span><span>  </span><span class="hs-comment">-- TrPushAxSym/TrPushSymAx</span><span>
</span><span id="line-774"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927370"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927370"><span class="hs-identifier hs-var">sym1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927369"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927369"><span class="hs-identifier hs-var">con1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927368"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927368"><span class="hs-identifier hs-var">ind1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927367"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927367"><span class="hs-identifier hs-var">cos1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927397"><span class="hs-identifier hs-var">co1_is_axiom_maybe</span></a></span><span>
</span><span id="line-775"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927366"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927366"><span class="hs-identifier hs-var">sym2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927365"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927365"><span class="hs-identifier hs-var">con2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927364"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927364"><span class="hs-identifier hs-var">ind2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927363"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927363"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927381"><span class="hs-identifier hs-var">co2_is_axiom_maybe</span></a></span><span>
</span><span id="line-776"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927369"><span class="hs-identifier hs-var">con1</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; CoAxiom Branched -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927365"><span class="hs-identifier hs-var">con2</span></a></span><span>
</span><span id="line-777"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927368"><span class="hs-identifier hs-var">ind1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927364"><span class="hs-identifier hs-var">ind2</span></a></span><span>
</span><span id="line-778"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927370"><span class="hs-identifier hs-var">sym1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927366"><span class="hs-identifier hs-var">sym2</span></a></span><span>
</span><span id="line-779"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927362"><span class="annot"><span class="annottext">branch :: CoAxBranch
</span><a href="#local-6989586621680927362"><span class="hs-identifier hs-var hs-var">branch</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; CoAxBranch
forall (br :: BranchFlag). CoAxiom br -&gt; Int -&gt; CoAxBranch
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomNthBranch"><span class="hs-identifier hs-var">coAxiomNthBranch</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927369"><span class="hs-identifier hs-var">con1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927368"><span class="hs-identifier hs-var">ind1</span></a></span><span>
</span><span id="line-780"></span><span>        </span><span id="local-6989586621680927361"><span class="annot"><span class="annottext">qtvs :: [TyCoVar]
</span><a href="#local-6989586621680927361"><span class="hs-identifier hs-var hs-var">qtvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchTyVars"><span class="hs-identifier hs-var">coAxBranchTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927362"><span class="hs-identifier hs-var">branch</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [TyCoVar] -&gt; [TyCoVar]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchCoVars"><span class="hs-identifier hs-var">coAxBranchCoVars</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927362"><span class="hs-identifier hs-var">branch</span></a></span><span>
</span><span id="line-781"></span><span>        </span><span id="local-6989586621680927358"><span class="annot"><span class="annottext">lhs :: Type
</span><a href="#local-6989586621680927358"><span class="hs-identifier hs-var hs-var">lhs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; Type
forall (br :: BranchFlag). CoAxiom br -&gt; Int -&gt; Type
</span><a href="GHC.Core.Type.html#coAxNthLHS"><span class="hs-identifier hs-var">coAxNthLHS</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927369"><span class="hs-identifier hs-var">con1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927368"><span class="hs-identifier hs-var">ind1</span></a></span><span>
</span><span id="line-782"></span><span>        </span><span id="local-6989586621680927356"><span class="annot"><span class="annottext">rhs :: Type
</span><a href="#local-6989586621680927356"><span class="hs-identifier hs-var hs-var">rhs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; Type
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchRHS"><span class="hs-identifier hs-var">coAxBranchRHS</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927362"><span class="hs-identifier hs-var">branch</span></a></span><span>
</span><span id="line-783"></span><span>        </span><span id="local-6989586621680927354"><span class="annot"><span class="annottext">pivot_tvs :: TyCoVarSet
</span><a href="#local-6989586621680927354"><span class="hs-identifier hs-var hs-var">pivot_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TyCoVarSet
</span><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier hs-var">exactTyCoVarsOfType</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927366"><span class="hs-identifier hs-var">sym2</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927356"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927358"><span class="hs-identifier hs-var">lhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-784"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(TyCoVar -&gt; Bool) -&gt; [TyCoVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; TyCoVarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarSet
</span><a href="#local-6989586621680927354"><span class="hs-identifier hs-var">pivot_tvs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927361"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-785"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TrPushAxSym&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-786"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927366"><span class="hs-identifier hs-var">sym2</span></a></span><span>
</span><span id="line-787"></span><span>       </span><span class="hs-comment">-- TrPushAxSym</span><span>
</span><span id="line-788"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Role -&gt; [TyCoVar] -&gt; [Coercion] -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubstWith"><span class="hs-identifier hs-var">liftCoSubstWith</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927350"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927361"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927367"><span class="hs-identifier hs-var">cos1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927363"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927358"><span class="hs-identifier hs-var">lhs</span></a></span><span>
</span><span id="line-789"></span><span>       </span><span class="hs-comment">-- TrPushSymAx</span><span>
</span><span id="line-790"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Role -&gt; [TyCoVar] -&gt; [Coercion] -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubstWith"><span class="hs-identifier hs-var">liftCoSubstWith</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927350"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927361"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
InScopeSet -&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#opt_transList"><span class="hs-identifier hs-var">opt_transList</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927404"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927367"><span class="hs-identifier hs-var">cos1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927363"><span class="hs-identifier hs-var">cos2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927356"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-791"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-792"></span><span>    </span><span id="local-6989586621680927397"><span class="annot"><span class="annottext">co1_is_axiom_maybe :: Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927397"><span class="hs-identifier hs-var hs-var">co1_is_axiom_maybe</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var">isAxiom_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-793"></span><span>    </span><span id="local-6989586621680927381"><span class="annot"><span class="annottext">co2_is_axiom_maybe :: Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="#local-6989586621680927381"><span class="hs-identifier hs-var hs-var">co2_is_axiom_maybe</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var">isAxiom_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927402"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-794"></span><span>    </span><span id="local-6989586621680927350"><span class="annot"><span class="annottext">role :: Role
</span><a href="#local-6989586621680927350"><span class="hs-keyword hs-var hs-var">role</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927403"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="hs-comment">-- should be the same as coercionRole co2!</span><span>
</span><span id="line-795"></span><span>
</span><span id="line-796"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927348"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927348"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927347"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927347"><span class="hs-identifier hs-var">co2</span></a></span></span><span>        </span><span class="hs-comment">-- Identity rule</span><span>
</span><span id="line-797"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927346"><span class="annot"><span class="annottext">ty1 :: Type
</span><a href="#local-6989586621680927346"><span class="hs-identifier hs-var hs-var">ty1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionLKind"><span class="hs-identifier hs-var">coercionLKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927348"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-798"></span><span>        </span><span id="local-6989586621680927344"><span class="annot"><span class="annottext">r :: Role
</span><a href="#local-6989586621680927344"><span class="hs-identifier hs-var hs-var">r</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927348"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-799"></span><span>        </span><span id="local-6989586621680927343"><span class="annot"><span class="annottext">ty2 :: Type
</span><a href="#local-6989586621680927343"><span class="hs-identifier hs-var hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionRKind"><span class="hs-identifier hs-var">coercionRKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927347"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-800"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927346"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927343"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-801"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;RedTypeDirRefl&quot;</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927348"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927347"><span class="hs-identifier hs-var">co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-802"></span><span>    </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkReflCo"><span class="hs-identifier hs-var">mkReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927344"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927343"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-803"></span><span>
</span><span id="line-804"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule"><span class="hs-identifier hs-var">opt_trans_rule</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Coercion
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-805"></span><span>
</span><span id="line-806"></span><span class="hs-comment">-- See Note [EtaAppCo]</span><span>
</span><span id="line-807"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-type">opt_trans_rule_app</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span>
</span><span id="line-808"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>   </span><span class="hs-comment">-- original left-hand coercion (printing only)</span><span>
</span><span id="line-809"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>   </span><span class="hs-comment">-- original right-hand coercion (printing only)</span><span>
</span><span id="line-810"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>   </span><span class="hs-comment">-- left-hand coercion &quot;function&quot;</span><span>
</span><span id="line-811"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- left-hand coercion &quot;args&quot;</span><span>
</span><span id="line-812"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>   </span><span class="hs-comment">-- right-hand coercion &quot;function&quot;</span><span>
</span><span id="line-813"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- right-hand coercion &quot;args&quot;</span><span>
</span><span id="line-814"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-815"></span><span id="opt_trans_rule_app"><span class="annot"><span class="annottext">opt_trans_rule_app :: InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var hs-var">opt_trans_rule_app</span></a></span></span><span> </span><span id="local-6989586621680927341"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927341"><span class="hs-identifier hs-var">is</span></a></span></span><span> </span><span id="local-6989586621680927340"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927340"><span class="hs-identifier hs-var">orig_co1</span></a></span></span><span> </span><span id="local-6989586621680927339"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927339"><span class="hs-identifier hs-var">orig_co2</span></a></span></span><span> </span><span id="local-6989586621680927338"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927338"><span class="hs-identifier hs-var">co1a</span></a></span></span><span> </span><span id="local-6989586621680927337"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span></span><span> </span><span id="local-6989586621680927336"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span></span><span> </span><span id="local-6989586621680927335"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span></span><span>
</span><span id="line-816"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927334"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927334"><span class="hs-identifier hs-var">co1aa</span></a></span></span><span> </span><span id="local-6989586621680927333"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927333"><span class="hs-identifier hs-var">co1ab</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927338"><span class="hs-identifier hs-var">co1a</span></a></span><span>
</span><span id="line-817"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927332"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927332"><span class="hs-identifier hs-var">co2aa</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927331"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927331"><span class="hs-identifier hs-var">co2ab</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-var">etaAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-818"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var">opt_trans_rule_app</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927341"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927340"><span class="hs-identifier hs-var">orig_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927339"><span class="hs-identifier hs-var">orig_co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927334"><span class="hs-identifier hs-var">co1aa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927333"><span class="hs-identifier hs-var">co1ab</span></a></span><span class="annot"><span class="annottext">Coercion -&gt; [Coercion] -&gt; [Coercion]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927332"><span class="hs-identifier hs-var">co2aa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927331"><span class="hs-identifier hs-var">co2ab</span></a></span><span class="annot"><span class="annottext">Coercion -&gt; [Coercion] -&gt; [Coercion]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppCo"><span class="hs-identifier hs-type">AppCo</span></a></span><span> </span><span id="local-6989586621680927330"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927330"><span class="hs-identifier hs-var">co2aa</span></a></span></span><span> </span><span id="local-6989586621680927329"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927329"><span class="hs-identifier hs-var">co2ab</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-821"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927328"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927328"><span class="hs-identifier hs-var">co1aa</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927327"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927327"><span class="hs-identifier hs-var">co1ab</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-var">etaAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927338"><span class="hs-identifier hs-var">co1a</span></a></span><span>
</span><span id="line-822"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; Coercion
-&gt; Coercion
-&gt; Coercion
-&gt; [Coercion]
-&gt; Coercion
-&gt; [Coercion]
-&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans_rule_app"><span class="hs-identifier hs-var">opt_trans_rule_app</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927341"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927340"><span class="hs-identifier hs-var">orig_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927339"><span class="hs-identifier hs-var">orig_co2</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927328"><span class="hs-identifier hs-var">co1aa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927327"><span class="hs-identifier hs-var">co1ab</span></a></span><span class="annot"><span class="annottext">Coercion -&gt; [Coercion] -&gt; [Coercion]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927330"><span class="hs-identifier hs-var">co2aa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927329"><span class="hs-identifier hs-var">co2ab</span></a></span><span class="annot"><span class="annottext">Coercion -&gt; [Coercion] -&gt; [Coercion]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-823"></span><span>
</span><span id="line-824"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-825"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">co1bs</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">equalLength</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">co2bs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-826"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var">fireTransRule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;EtaApps:&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Coercion] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927340"><span class="hs-identifier hs-var">orig_co1</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927339"><span class="hs-identifier hs-var">orig_co2</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Maybe Coercion) -&gt; Coercion -&gt; Maybe Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-827"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927324"><span class="annot"><span class="annottext">rt1a :: Type
</span><a href="#local-6989586621680927324"><span class="hs-identifier hs-var hs-var">rt1a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionRKind"><span class="hs-identifier hs-var">coercionRKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927338"><span class="hs-identifier hs-var">co1a</span></a></span><span>
</span><span id="line-828"></span><span>
</span><span id="line-829"></span><span>        </span><span id="local-6989586621680927323"><span class="annot"><span class="annottext">lt2a :: Type
</span><a href="#local-6989586621680927323"><span class="hs-identifier hs-var hs-var">lt2a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionLKind"><span class="hs-identifier hs-var">coercionLKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-830"></span><span>        </span><span id="local-6989586621680927322"><span class="annot"><span class="annottext">rt2a :: Role
</span><a href="#local-6989586621680927322"><span class="hs-identifier hs-var hs-var">rt2a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span>  </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-831"></span><span>
</span><span id="line-832"></span><span>        </span><span id="local-6989586621680927321"><span class="annot"><span class="annottext">rt1bs :: [Type]
</span><a href="#local-6989586621680927321"><span class="hs-identifier hs-var hs-var">rt1bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Type) -&gt; [Coercion] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionRKind"><span class="hs-identifier hs-var">coercionRKind</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span><span>
</span><span id="line-833"></span><span>        </span><span id="local-6989586621680927320"><span class="annot"><span class="annottext">lt2bs :: [Type]
</span><a href="#local-6989586621680927320"><span class="hs-identifier hs-var hs-var">lt2bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Type) -&gt; [Coercion] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionLKind"><span class="hs-identifier hs-var">coercionLKind</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span><span>
</span><span id="line-834"></span><span>        </span><span id="local-6989586621680927319"><span class="annot"><span class="annottext">rt2bs :: [Role]
</span><a href="#local-6989586621680927319"><span class="hs-identifier hs-var hs-var">rt2bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Role) -&gt; [Coercion] -&gt; [Role]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Role
</span><a href="GHC.Core.Coercion.html#coercionRole"><span class="hs-identifier hs-var">coercionRole</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span><span>
</span><span id="line-835"></span><span>
</span><span id="line-836"></span><span>        </span><span id="local-6989586621680927318"><span class="annot"><span class="annottext">kcoa :: Coercion
</span><a href="#local-6989586621680927318"><span class="hs-identifier hs-var hs-var">kcoa</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkKindCo"><span class="hs-identifier hs-var">mkKindCo</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; Coercion -&gt; Coercion
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#buildCoercion"><span class="hs-identifier hs-var">buildCoercion</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927323"><span class="hs-identifier hs-var">lt2a</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927324"><span class="hs-identifier hs-var">rt1a</span></a></span><span>
</span><span id="line-837"></span><span>        </span><span id="local-6989586621680927316"><span class="annot"><span class="annottext">kcobs :: [Coercion]
</span><a href="#local-6989586621680927316"><span class="hs-identifier hs-var hs-var">kcobs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkKindCo"><span class="hs-identifier hs-var">mkKindCo</span></a></span><span> </span><span class="annot"><span class="annottext">([Coercion] -&gt; [Coercion]) -&gt; [Coercion] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type -&gt; Coercion) -&gt; [Type] -&gt; [Type] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#buildCoercion"><span class="hs-identifier hs-var">buildCoercion</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927320"><span class="hs-identifier hs-var">lt2bs</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927321"><span class="hs-identifier hs-var">rt1bs</span></a></span><span>
</span><span id="line-838"></span><span>
</span><span id="line-839"></span><span>        </span><span id="local-6989586621680927315"><span class="annot"><span class="annottext">co2a' :: Coercion
</span><a href="#local-6989586621680927315"><span class="hs-identifier hs-var hs-var">co2a'</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoherenceLeftCo"><span class="hs-identifier hs-var">mkCoherenceLeftCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927322"><span class="hs-identifier hs-var">rt2a</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927323"><span class="hs-identifier hs-var">lt2a</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927318"><span class="hs-identifier hs-var">kcoa</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927336"><span class="hs-identifier hs-var">co2a</span></a></span><span>
</span><span id="line-840"></span><span>        </span><span id="local-6989586621680927313"><span class="annot"><span class="annottext">co2bs' :: [Coercion]
</span><a href="#local-6989586621680927313"><span class="hs-identifier hs-var hs-var">co2bs'</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Role -&gt; Type -&gt; Coercion -&gt; Coercion)
-&gt; [Role] -&gt; [Type] -&gt; [Coercion] -&gt; [Coercion]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="../../base/src/GHC.List.html#zipWith3"><span class="hs-identifier hs-var">zipWith3</span></a></span><span> </span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkGReflLeftCo"><span class="hs-identifier hs-var">mkGReflLeftCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621680927319"><span class="hs-identifier hs-var">rt2bs</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927320"><span class="hs-identifier hs-var">lt2bs</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927316"><span class="hs-identifier hs-var">kcobs</span></a></span><span>
</span><span id="line-841"></span><span>        </span><span id="local-6989586621680927311"><span class="annot"><span class="annottext">co2bs'' :: [Coercion]
</span><a href="#local-6989586621680927311"><span class="hs-identifier hs-var hs-var">co2bs''</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion -&gt; Coercion)
-&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-identifier hs-var">mkTransCo</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927313"><span class="hs-identifier hs-var">co2bs'</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927335"><span class="hs-identifier hs-var">co2bs</span></a></span><span>
</span><span id="line-842"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-843"></span><span>    </span><span class="annot"><span class="annottext">Coercion -&gt; [Coercion] -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkAppCos"><span class="hs-identifier hs-var">mkAppCos</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927341"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927338"><span class="hs-identifier hs-var">co1a</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927315"><span class="hs-identifier hs-var">co2a'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-844"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Coercion -&gt; Coercion)
-&gt; [Coercion] -&gt; [Coercion] -&gt; [Coercion]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_trans"><span class="hs-identifier hs-var">opt_trans</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927341"><span class="hs-identifier hs-var">is</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927337"><span class="hs-identifier hs-var">co1bs</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927311"><span class="hs-identifier hs-var">co2bs''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-845"></span><span>
</span><span id="line-846"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-type">fireTransRule</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-847"></span><span id="fireTransRule"><span class="annot"><span class="annottext">fireTransRule :: String -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.Opt.html#fireTransRule"><span class="hs-identifier hs-var hs-var">fireTransRule</span></a></span></span><span> </span><span id="local-6989586621680927309"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680927309"><span class="hs-identifier hs-var">_rule</span></a></span></span><span> </span><span id="local-6989586621680927308"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927308"><span class="hs-identifier hs-var">_co1</span></a></span></span><span> </span><span id="local-6989586621680927307"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927307"><span class="hs-identifier hs-var">_co2</span></a></span></span><span> </span><span id="local-6989586621680927306"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927306"><span class="hs-identifier hs-var">res</span></a></span></span><span>
</span><span id="line-848"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe Coercion
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927306"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-849"></span><span>
</span><span id="line-850"></span><span class="hs-comment">{-
Note [Conflict checking with AxiomInstCo]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following type family and axiom:

type family Equal (a :: k) (b :: k) :: Bool
type instance where
  Equal a a = True
  Equal a b = False
--
Equal :: forall k::*. k -&gt; k -&gt; Bool
axEqual :: { forall k::*. forall a::k. Equal k a a ~ True
           ; forall k::*. forall a::k. forall b::k. Equal k a b ~ False }

We wish to disallow (axEqual[1] &lt;*&gt; &lt;Int&gt; &lt;Int). (Recall that the index is
0-based, so this is the second branch of the axiom.) The problem is that, on
the surface, it seems that (axEqual[1] &lt;*&gt; &lt;Int&gt; &lt;Int&gt;) :: (Equal * Int Int ~
False) and that all is OK. But, all is not OK: we want to use the first branch
of the axiom in this case, not the second. The problem is that the parameters
of the first branch can unify with the supplied coercions, thus meaning that
the first branch should be taken. See also Note [Apartness] in
&quot;GHC.Core.FamInstEnv&quot;.

Note [Why call checkAxInstCo during optimisation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is possible that otherwise-good-looking optimisations meet with disaster
in the presence of axioms with multiple equations. Consider

type family Equal (a :: *) (b :: *) :: Bool where
  Equal a a = True
  Equal a b = False
type family Id (a :: *) :: * where
  Id a = a

axEq :: { [a::*].       Equal a a ~ True
        ; [a::*, b::*]. Equal a b ~ False }
axId :: [a::*]. Id a ~ a

co1 = Equal (axId[0] Int) (axId[0] Bool)
  :: Equal (Id Int) (Id Bool) ~  Equal Int Bool
co2 = axEq[1] &lt;Int&gt; &lt;Bool&gt;
  :: Equal Int Bool ~ False

We wish to optimise (co1 ; co2). We end up in rule TrPushAxL, noting that
co2 is an axiom and that matchAxiom succeeds when looking at co1. But, what
happens when we push the coercions inside? We get

co3 = axEq[1] (axId[0] Int) (axId[0] Bool)
  :: Equal (Id Int) (Id Bool) ~ False

which is bogus! This is because the type system isn't smart enough to know
that (Id Int) and (Id Bool) are Surely Apart, as they're headed by type
families. At the time of writing, I (Richard Eisenberg) couldn't think of
a way of detecting this any more efficient than just building the optimised
coercion and checking.

Note [EtaAppCo]
~~~~~~~~~~~~~~~
Suppose we're trying to optimize (co1a co1b ; co2a co2b). Ideally, we'd
like to rewrite this to (co1a ; co2a) (co1b ; co2b). The problem is that
the resultant coercions might not be well kinded. Here is an example (things
labeled with x don't matter in this example):

  k1 :: Type
  k2 :: Type

  a :: k1 -&gt; Type
  b :: k1

  h :: k1 ~ k2

  co1a :: x1 ~ (a |&gt; (h -&gt; &lt;Type&gt;)
  co1b :: x2 ~ (b |&gt; h)

  co2a :: a ~ x3
  co2b :: b ~ x4

First, convince yourself of the following:

  co1a co1b :: x1 x2 ~ (a |&gt; (h -&gt; &lt;Type&gt;)) (b |&gt; h)
  co2a co2b :: a b   ~ x3 x4

  (a |&gt; (h -&gt; &lt;Type&gt;)) (b |&gt; h) `eqType` a b

That last fact is due to Note [Non-trivial definitional equality] in GHC.Core.TyCo.Rep,
where we ignore coercions in types as long as two types' kinds are the same.
In our case, we meet this last condition, because

  (a |&gt; (h -&gt; &lt;Type&gt;)) (b |&gt; h) :: Type
    and
  a b :: Type

So the input coercion (co1a co1b ; co2a co2b) is well-formed. But the
suggested output coercions (co1a ; co2a) and (co1b ; co2b) are not -- the
kinds don't match up.

The solution here is to twiddle the kinds in the output coercions. First, we
need to find coercions

  ak :: kind(a |&gt; (h -&gt; &lt;Type&gt;)) ~ kind(a)
  bk :: kind(b |&gt; h)             ~ kind(b)

This can be done with mkKindCo and buildCoercion. The latter assumes two
types are identical modulo casts and builds a coercion between them.

Then, we build (co1a ; co2a |&gt; sym ak) and (co1b ; co2b |&gt; sym bk) as the
output coercions. These are well-kinded.

Also, note that all of this is done after accumulated any nested AppCo
parameters. This step is to avoid quadratic behavior in calling coercionKind.

The problem described here was first found in dependent/should_compile/dynamic-paper.

-}</span><span>
</span><span id="line-964"></span><span>
</span><span id="line-965"></span><span class="hs-comment">-- | Check to make sure that an AxInstCo is internally consistent.</span><span>
</span><span id="line-966"></span><span class="hs-comment">-- Returns the conflicting branch, if it exists</span><span>
</span><span id="line-967"></span><span class="hs-comment">-- See Note [Conflict checking with AxiomInstCo]</span><span>
</span><span id="line-968"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-type">checkAxInstCo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxBranch"><span class="hs-identifier hs-type">CoAxBranch</span></a></span><span>
</span><span id="line-969"></span><span class="hs-comment">-- defined here to avoid dependencies in GHC.Core.Coercion</span><span>
</span><span id="line-970"></span><span class="hs-comment">-- If you edit this function, you may need to update the GHC formalism</span><span>
</span><span id="line-971"></span><span class="hs-comment">-- See Note [GHC Formalism] in GHC.Core.Lint</span><span>
</span><span id="line-972"></span><span id="checkAxInstCo"><span class="annot"><span class="annottext">checkAxInstCo :: Coercion -&gt; Maybe CoAxBranch
</span><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var hs-var">checkAxInstCo</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-type">AxiomInstCo</span></a></span><span> </span><span id="local-6989586621680927305"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927305"><span class="hs-identifier hs-var">ax</span></a></span></span><span> </span><span id="local-6989586621680927304"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927304"><span class="hs-identifier hs-var">ind</span></a></span></span><span> </span><span id="local-6989586621680927303"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927303"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-973"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927302"><span class="annot"><span class="annottext">branch :: CoAxBranch
</span><a href="#local-6989586621680927302"><span class="hs-identifier hs-var hs-var">branch</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched -&gt; Int -&gt; CoAxBranch
forall (br :: BranchFlag). CoAxiom br -&gt; Int -&gt; CoAxBranch
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomNthBranch"><span class="hs-identifier hs-var">coAxiomNthBranch</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927305"><span class="hs-identifier hs-var">ax</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927304"><span class="hs-identifier hs-var">ind</span></a></span><span>
</span><span id="line-974"></span><span>        </span><span id="local-6989586621680927301"><span class="annot"><span class="annottext">tvs :: [TyCoVar]
</span><a href="#local-6989586621680927301"><span class="hs-identifier hs-var hs-var">tvs</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchTyVars"><span class="hs-identifier hs-var">coAxBranchTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927302"><span class="hs-identifier hs-var">branch</span></a></span><span>
</span><span id="line-975"></span><span>        </span><span id="local-6989586621680927300"><span class="annot"><span class="annottext">cvs :: [TyCoVar]
</span><a href="#local-6989586621680927300"><span class="hs-identifier hs-var hs-var">cvs</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchCoVars"><span class="hs-identifier hs-var">coAxBranchCoVars</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927302"><span class="hs-identifier hs-var">branch</span></a></span><span>
</span><span id="line-976"></span><span>        </span><span id="local-6989586621680927299"><span class="annot"><span class="annottext">incomps :: [CoAxBranch]
</span><a href="#local-6989586621680927299"><span class="hs-identifier hs-var hs-var">incomps</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [CoAxBranch]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchIncomps"><span class="hs-identifier hs-var">coAxBranchIncomps</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927302"><span class="hs-identifier hs-var">branch</span></a></span><span>
</span><span id="line-977"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680927297"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927297"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927296"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927296"><span class="hs-identifier hs-var">cotys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Type] -&gt; ([Type], [Type])
forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927301"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Coercion -&gt; Type) -&gt; [Coercion] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionLKind"><span class="hs-identifier hs-var">coercionLKind</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927303"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-978"></span><span>        </span><span id="local-6989586621680927294"><span class="annot"><span class="annottext">co_args :: [Coercion]
</span><a href="#local-6989586621680927294"><span class="hs-identifier hs-var hs-var">co_args</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Coercion) -&gt; [Type] -&gt; [Coercion]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Coercion
</span><a href="GHC.Core.Type.html#stripCoercionTy"><span class="hs-identifier hs-var">stripCoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927296"><span class="hs-identifier hs-var">cotys</span></a></span><span>
</span><span id="line-979"></span><span>        </span><span id="local-6989586621680927290"><span class="annot"><span class="annottext">subst :: TCvSubst
</span><a href="#local-6989586621680927290"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Type] -&gt; TCvSubst
HasDebugCallStack =&gt; [TyCoVar] -&gt; [Type] -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier hs-var">zipTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927301"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927297"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; TCvSubst -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#composeTCvSubst"><span class="hs-operator hs-var">`composeTCvSubst`</span></a></span><span>
</span><span id="line-980"></span><span>                       </span><span class="annot"><span class="annottext">[TyCoVar] -&gt; [Coercion] -&gt; TCvSubst
HasDebugCallStack =&gt; [TyCoVar] -&gt; [Coercion] -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipCvSubst"><span class="hs-identifier hs-var">zipCvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927300"><span class="hs-identifier hs-var">cvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927294"><span class="hs-identifier hs-var">co_args</span></a></span><span>
</span><span id="line-981"></span><span>        </span><span id="local-6989586621680927285"><span class="annot"><span class="annottext">target :: [Type]
</span><a href="#local-6989586621680927285"><span class="hs-identifier hs-var hs-var">target</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [Type] -&gt; [Type]
TCvSubst -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Subst.html#substTys"><span class="hs-identifier hs-var">Type.substTys</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680927290"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoAxBranch -&gt; [Type]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchLHS"><span class="hs-identifier hs-var">coAxBranchLHS</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927302"><span class="hs-identifier hs-var">branch</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-982"></span><span>        </span><span id="local-6989586621680927282"><span class="annot"><span class="annottext">in_scope :: InScopeSet
</span><a href="#local-6989586621680927282"><span class="hs-identifier hs-var hs-var">in_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVarSet -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#mkInScopeSet"><span class="hs-identifier hs-var">mkInScopeSet</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCoVarSet -&gt; InScopeSet) -&gt; TyCoVarSet -&gt; InScopeSet
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-983"></span><span>                   </span><span class="annot"><span class="annottext">[TyCoVarSet] -&gt; TyCoVarSet
</span><a href="GHC.Types.Var.Set.html#unionVarSets"><span class="hs-identifier hs-var">unionVarSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CoAxBranch -&gt; TyCoVarSet) -&gt; [CoAxBranch] -&gt; [TyCoVarSet]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; TyCoVarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">([Type] -&gt; TyCoVarSet)
-&gt; (CoAxBranch -&gt; [Type]) -&gt; CoAxBranch -&gt; TyCoVarSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; [Type]
</span><a href="GHC.Core.Coercion.Axiom.html#coAxBranchLHS"><span class="hs-identifier hs-var">coAxBranchLHS</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[CoAxBranch]
</span><a href="#local-6989586621680927299"><span class="hs-identifier hs-var">incomps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-984"></span><span>        </span><span id="local-6989586621680927277"><span class="annot"><span class="annottext">flattened_target :: [Type]
</span><a href="#local-6989586621680927277"><span class="hs-identifier hs-var hs-var">flattened_target</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Core.FamInstEnv.html#flattenTys"><span class="hs-identifier hs-var">flattenTys</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680927282"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927285"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-985"></span><span>    </span><span class="annot"><span class="annottext">[Type] -&gt; [CoAxBranch] -&gt; Maybe CoAxBranch
</span><a href="#local-6989586621680927276"><span class="hs-identifier hs-var">check_no_conflict</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927277"><span class="hs-identifier hs-var">flattened_target</span></a></span><span> </span><span class="annot"><span class="annottext">[CoAxBranch]
</span><a href="#local-6989586621680927299"><span class="hs-identifier hs-var">incomps</span></a></span><span>
</span><span id="line-986"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-987"></span><span>    </span><span class="annot"><a href="#local-6989586621680927276"><span class="hs-identifier hs-type">check_no_conflict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxBranch"><span class="hs-identifier hs-type">CoAxBranch</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxBranch"><span class="hs-identifier hs-type">CoAxBranch</span></a></span><span>
</span><span id="line-988"></span><span>    </span><span id="local-6989586621680927276"><span class="annot"><span class="annottext">check_no_conflict :: [Type] -&gt; [CoAxBranch] -&gt; Maybe CoAxBranch
</span><a href="#local-6989586621680927276"><span class="hs-identifier hs-var hs-var">check_no_conflict</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-989"></span><span>    </span><span class="annot"><a href="#local-6989586621680927276"><span class="hs-identifier hs-var">check_no_conflict</span></a></span><span> </span><span id="local-6989586621680927275"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927275"><span class="hs-identifier hs-var">flat</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927274"><span class="annot"><span class="annottext">b :: CoAxBranch
</span><a href="#local-6989586621680927274"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxBranch"><span class="hs-identifier hs-type">CoAxBranch</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cab_lhs :: CoAxBranch -&gt; [Type]
</span><a href="GHC.Core.Coercion.Axiom.html#cab_lhs"><span class="hs-identifier hs-var">cab_lhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927271"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927271"><span class="hs-identifier hs-var">lhs_incomp</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680927270"><span class="annot"><span class="annottext">[CoAxBranch]
</span><a href="#local-6989586621680927270"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-990"></span><span>         </span><span class="hs-comment">-- See Note [Apartness] in GHC.Core.FamInstEnv</span><span>
</span><span id="line-991"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">UnifyResultM TCvSubst
</span><a href="GHC.Core.Unify.html#SurelyApart"><span class="hs-identifier hs-var">SurelyApart</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TyCoVar -&gt; BindFlag) -&gt; [Type] -&gt; [Type] -&gt; UnifyResultM TCvSubst
</span><a href="GHC.Core.Unify.html#tcUnifyTysFG"><span class="hs-identifier hs-var">tcUnifyTysFG</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; BindFlag
</span><a href="GHC.Core.InstEnv.html#instanceBindFun"><span class="hs-identifier hs-var">instanceBindFun</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927275"><span class="hs-identifier hs-var">flat</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927271"><span class="hs-identifier hs-var">lhs_incomp</span></a></span><span>
</span><span id="line-992"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [CoAxBranch] -&gt; Maybe CoAxBranch
</span><a href="#local-6989586621680927276"><span class="hs-identifier hs-var">check_no_conflict</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927275"><span class="hs-identifier hs-var">flat</span></a></span><span> </span><span class="annot"><span class="annottext">[CoAxBranch]
</span><a href="#local-6989586621680927270"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-993"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-994"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoAxBranch -&gt; Maybe CoAxBranch
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxBranch
</span><a href="#local-6989586621680927274"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-995"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#checkAxInstCo"><span class="hs-identifier hs-var">checkAxInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe CoAxBranch
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span>
</span><span id="line-998"></span><span class="hs-comment">-----------</span><span>
</span><span id="line-999"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-type">wrapSym</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#SymFlag"><span class="hs-identifier hs-type">SymFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-1000"></span><span id="wrapSym"><span class="annot"><span class="annottext">wrapSym :: Bool -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapSym"><span class="hs-identifier hs-var hs-var">wrapSym</span></a></span></span><span> </span><span id="local-6989586621680927266"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927266"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927265"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927265"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927266"><span class="hs-identifier hs-var">sym</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927265"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1001"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927265"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1002"></span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- | Conditionally set a role to be representational</span><span>
</span><span id="line-1004"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-type">wrapRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#ReprFlag"><span class="hs-identifier hs-type">ReprFlag</span></a></span><span>
</span><span id="line-1005"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>         </span><span class="hs-comment">-- ^ current role</span><span>
</span><span id="line-1006"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-1007"></span><span id="wrapRole"><span class="annot"><span class="annottext">wrapRole :: Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var hs-var">wrapRole</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1008"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#wrapRole"><span class="hs-identifier hs-var">wrapRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span id="local-6989586621680927263"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927263"><span class="hs-identifier hs-var">current</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#downgradeRole"><span class="hs-identifier hs-var">downgradeRole</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927263"><span class="hs-identifier hs-var">current</span></a></span><span>
</span><span id="line-1009"></span><span>
</span><span id="line-1010"></span><span class="hs-comment">-- | If we require a representational role, return that. Otherwise,</span><span>
</span><span id="line-1011"></span><span class="hs-comment">-- return the &quot;default&quot; role provided.</span><span>
</span><span id="line-1012"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-type">chooseRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#ReprFlag"><span class="hs-identifier hs-type">ReprFlag</span></a></span><span>
</span><span id="line-1013"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>    </span><span class="hs-comment">-- ^ &quot;default&quot; role</span><span>
</span><span id="line-1014"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>
</span><span id="line-1015"></span><span id="chooseRole"><span class="annot"><span class="annottext">chooseRole :: Bool -&gt; Role -&gt; Role
</span><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var hs-var">chooseRole</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span>
</span><span id="line-1016"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#chooseRole"><span class="hs-identifier hs-var">chooseRole</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span id="local-6989586621680927262"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927262"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927262"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1017"></span><span>
</span><span id="line-1018"></span><span class="hs-comment">-----------</span><span>
</span><span id="line-1019"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-type">isAxiom_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxiom"><span class="hs-identifier hs-type">CoAxiom</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Branched"><span class="hs-identifier hs-type">Branched</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1020"></span><span id="isAxiom_maybe"><span class="annot"><span class="annottext">isAxiom_maybe :: Coercion -&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var hs-var">isAxiom_maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#SymCo"><span class="hs-identifier hs-type">SymCo</span></a></span><span> </span><span id="local-6989586621680927261"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927261"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1021"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927260"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927260"><span class="hs-identifier hs-var">sym</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927259"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927259"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927258"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927258"><span class="hs-identifier hs-var">ind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927257"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927257"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
</span><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var">isAxiom_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927261"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1022"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool, CoAxiom Branched, Int, [Coercion])
-&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927260"><span class="hs-identifier hs-var">sym</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927259"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927258"><span class="hs-identifier hs-var">ind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927257"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1023"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var">isAxiom_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AxiomInstCo"><span class="hs-identifier hs-type">AxiomInstCo</span></a></span><span> </span><span id="local-6989586621680927256"><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927256"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621680927255"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927255"><span class="hs-identifier hs-var">ind</span></a></span></span><span> </span><span id="local-6989586621680927254"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927254"><span class="hs-identifier hs-var">cos</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1024"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bool, CoAxiom Branched, Int, [Coercion])
-&gt; Maybe (Bool, CoAxiom Branched, Int, [Coercion])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoAxiom Branched
</span><a href="#local-6989586621680927256"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927255"><span class="hs-identifier hs-var">ind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927254"><span class="hs-identifier hs-var">cos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1025"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#isAxiom_maybe"><span class="hs-identifier hs-var">isAxiom_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, CoAxiom Branched, Int, [Coercion])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1026"></span><span>
</span><span id="line-1027"></span><span id="local-6989586621680928197"><span class="annot"><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-type">matchAxiom</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-comment">-- True = match LHS, False = match RHS</span><span>
</span><span id="line-1028"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxiom"><span class="hs-identifier hs-type">CoAxiom</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680928197"><span class="hs-identifier hs-type">br</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1029"></span><span id="matchAxiom"><span class="annot"><span class="annottext">matchAxiom :: forall (br :: BranchFlag).
Bool -&gt; CoAxiom br -&gt; Int -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#matchAxiom"><span class="hs-identifier hs-var hs-var">matchAxiom</span></a></span></span><span> </span><span id="local-6989586621680927250"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927250"><span class="hs-identifier hs-var">sym</span></a></span></span><span> </span><span id="local-6989586621680927249"><span class="annot"><span class="annottext">ax :: CoAxiom br
</span><a href="#local-6989586621680927249"><span class="hs-identifier hs-var">ax</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxiom"><span class="hs-identifier hs-type">CoAxiom</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">co_ax_tc :: forall (br :: BranchFlag). CoAxiom br -&gt; TyCon
</span><a href="GHC.Core.Coercion.Axiom.html#co_ax_tc"><span class="hs-identifier hs-var">co_ax_tc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927246"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927246"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680927245"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927245"><span class="hs-identifier hs-var">ind</span></a></span></span><span> </span><span id="local-6989586621680927244"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927244"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1030"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#CoAxBranch"><span class="hs-identifier hs-type">CoAxBranch</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cab_tvs :: CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#cab_tvs"><span class="hs-identifier hs-var">cab_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927242"><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927242"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span>
</span><span id="line-1031"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cab_cvs :: CoAxBranch -&gt; [TyCoVar]
</span><a href="GHC.Core.Coercion.Axiom.html#cab_cvs"><span class="hs-identifier hs-var">cab_cvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- can't infer these, so fail if there are any</span><span>
</span><span id="line-1032"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cab_roles :: CoAxBranch -&gt; [Role]
</span><a href="GHC.Core.Coercion.Axiom.html#cab_roles"><span class="hs-identifier hs-var">cab_roles</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927239"><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621680927239"><span class="hs-identifier hs-var">roles</span></a></span></span><span>
</span><span id="line-1033"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cab_lhs :: CoAxBranch -&gt; [Type]
</span><a href="GHC.Core.Coercion.Axiom.html#cab_lhs"><span class="hs-identifier hs-var">cab_lhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927238"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927238"><span class="hs-identifier hs-var">lhs</span></a></span></span><span>
</span><span id="line-1034"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cab_rhs :: CoAxBranch -&gt; Type
</span><a href="GHC.Core.Coercion.Axiom.html#cab_rhs"><span class="hs-identifier hs-var">cab_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680927236"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927236"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoAxiom br -&gt; Int -&gt; CoAxBranch
forall (br :: BranchFlag). CoAxiom br -&gt; Int -&gt; CoAxBranch
</span><a href="GHC.Core.Coercion.Axiom.html#coAxiomNthBranch"><span class="hs-identifier hs-var">coAxiomNthBranch</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom br
</span><a href="#local-6989586621680927249"><span class="hs-identifier hs-var">ax</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927245"><span class="hs-identifier hs-var">ind</span></a></span><span>
</span><span id="line-1035"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680927235"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927235"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCoVarSet -&gt; Type -&gt; Coercion -&gt; Maybe LiftingContext
</span><a href="GHC.Core.Unify.html#liftCoMatch"><span class="hs-identifier hs-var">liftCoMatch</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyCoVar] -&gt; TyCoVarSet
</span><a href="GHC.Types.Var.Set.html#mkVarSet"><span class="hs-identifier hs-var">mkVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927242"><span class="hs-identifier hs-var">qtvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1036"></span><span>                              </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927250"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927246"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927238"><span class="hs-identifier hs-var">lhs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927236"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1037"></span><span>                              </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927244"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1038"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(TyCoVar -&gt; Bool) -&gt; [TyCoVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; LiftingContext -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isMappedByLC"><span class="hs-operator hs-var">`isMappedByLC`</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927235"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927242"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-1039"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Role -&gt; TyCoVar -&gt; Maybe Coercion)
-&gt; [Role] -&gt; [TyCoVar] -&gt; Maybe [Coercion]
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; b -&gt; m c) -&gt; [a] -&gt; [b] -&gt; m [c]
</span><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier hs-var">zipWithM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Role -&gt; TyCoVar -&gt; Maybe Coercion
</span><a href="GHC.Core.Coercion.html#liftCoSubstTyVar"><span class="hs-identifier hs-var">liftCoSubstTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927235"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Role]
</span><a href="#local-6989586621680927239"><span class="hs-identifier hs-var">roles</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVar]
</span><a href="#local-6989586621680927242"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-1040"></span><span>
</span><span id="line-1041"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1042"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [Coercion]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1043"></span><span>
</span><span id="line-1044"></span><span class="hs-comment">-------------</span><span>
</span><span id="line-1045"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#compatible_co"><span class="hs-identifier hs-type">compatible_co</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1046"></span><span class="hs-comment">-- Check whether (co1 . co2) will be well-kinded</span><span>
</span><span id="line-1047"></span><span id="compatible_co"><span class="annot"><span class="annottext">compatible_co :: Coercion -&gt; Coercion -&gt; Bool
</span><a href="GHC.Core.Coercion.Opt.html#compatible_co"><span class="hs-identifier hs-var hs-var">compatible_co</span></a></span></span><span> </span><span id="local-6989586621680927229"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927229"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span id="local-6989586621680927228"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927228"><span class="hs-identifier hs-var">co2</span></a></span></span><span>
</span><span id="line-1048"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927227"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927226"><span class="hs-identifier hs-var">x2</span></a></span><span>
</span><span id="line-1049"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1050"></span><span>    </span><span id="local-6989586621680927227"><span class="annot"><span class="annottext">x1 :: Type
</span><a href="#local-6989586621680927227"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionRKind"><span class="hs-identifier hs-var">coercionRKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927229"><span class="hs-identifier hs-var">co1</span></a></span><span>
</span><span id="line-1051"></span><span>    </span><span id="local-6989586621680927226"><span class="annot"><span class="annottext">x2 :: Type
</span><a href="#local-6989586621680927226"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Type
</span><a href="GHC.Core.Coercion.html#coercionLKind"><span class="hs-identifier hs-var">coercionLKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927228"><span class="hs-identifier hs-var">co2</span></a></span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="hs-comment">-------------</span><span>
</span><span id="line-1054"></span><span class="hs-comment">{-
etaForAllCo
~~~~~~~~~~~~~~~~~
(1) etaForAllCo_ty_maybe
Suppose we have

  g : all a1:k1.t1  ~  all a2:k2.t2

but g is *not* a ForAllCo. We want to eta-expand it. So, we do this:

  g' = all a1:(ForAllKindCo g).(InstCo g (a1 ~ a1 |&gt; ForAllKindCo g))

Call the kind coercion h1 and the body coercion h2. We can see that

  h2 : t1 ~ t2[a2 |-&gt; (a1 |&gt; h1)]

According to the typing rule for ForAllCo, we get that

  g' : all a1:k1.t1  ~  all a1:k2.(t2[a2 |-&gt; (a1 |&gt; h1)][a1 |-&gt; a1 |&gt; sym h1])

or

  g' : all a1:k1.t1  ~  all a1:k2.(t2[a2 |-&gt; a1])

as desired.

(2) etaForAllCo_co_maybe
Suppose we have

  g : all c1:(s1~s2). t1 ~ all c2:(s3~s4). t2

Similarly, we do this

  g' = all c1:h1. h2
     : all c1:(s1~s2). t1 ~ all c1:(s3~s4). t2[c2 |-&gt; (sym eta1;c1;eta2)]
                                              [c1 |-&gt; eta1;c1;sym eta2]

Here,

  h1   = mkNthCo Nominal 0 g :: (s1~s2)~(s3~s4)
  eta1 = mkNthCo r 2 h1      :: (s1 ~ s3)
  eta2 = mkNthCo r 3 h1      :: (s2 ~ s4)
  h2   = mkInstCo g (cv1 ~ (sym eta1;c1;eta2))
-}</span><span>
</span><span id="line-1098"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_ty_maybe"><span class="hs-identifier hs-type">etaForAllCo_ty_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1099"></span><span class="hs-comment">-- Try to make the coercion be of form (forall tv:kind_co. co)</span><span>
</span><span id="line-1100"></span><span id="etaForAllCo_ty_maybe"><span class="annot"><span class="annottext">etaForAllCo_ty_maybe :: Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_ty_maybe"><span class="hs-identifier hs-var hs-var">etaForAllCo_ty_maybe</span></a></span></span><span> </span><span id="local-6989586621680927224"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927224"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1101"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927223"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927223"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927222"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927222"><span class="hs-identifier hs-var">kind_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927221"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927221"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_ty_maybe"><span class="hs-identifier hs-var">splitForAllCo_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927224"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1102"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCoVar, Coercion, Coercion)
-&gt; Maybe (TyCoVar, Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927223"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927222"><span class="hs-identifier hs-var">kind_co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927221"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1103"></span><span>
</span><span id="line-1104"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927220"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927220"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927219"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927219"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927224"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1105"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927218"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927218"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_ty_maybe"><span class="hs-identifier hs-var">splitForAllTy_ty_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927220"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1106"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy_ty"><span class="hs-identifier hs-var">isForAllTy_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927219"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1107"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927215"><span class="annot"><span class="annottext">kind_co :: Coercion
</span><a href="#local-6989586621680927215"><span class="hs-identifier hs-var hs-var">kind_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927224"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1108"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCoVar, Coercion, Coercion)
-&gt; Maybe (TyCoVar, Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927218"><span class="hs-identifier hs-var">tv1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927215"><span class="hs-identifier hs-var">kind_co</span></a></span><span>
</span><span id="line-1109"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927224"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkGReflRightCo"><span class="hs-identifier hs-var">mkGReflRightCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-var">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927218"><span class="hs-identifier hs-var">tv1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927215"><span class="hs-identifier hs-var">kind_co</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1110"></span><span>
</span><span id="line-1111"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1112"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (TyCoVar, Coercion, Coercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1113"></span><span>
</span><span id="line-1114"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_co_maybe"><span class="hs-identifier hs-type">etaForAllCo_co_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#CoVar"><span class="hs-identifier hs-type">CoVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1115"></span><span class="hs-comment">-- Try to make the coercion be of form (forall cv:kind_co. co)</span><span>
</span><span id="line-1116"></span><span id="etaForAllCo_co_maybe"><span class="annot"><span class="annottext">etaForAllCo_co_maybe :: Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaForAllCo_co_maybe"><span class="hs-identifier hs-var hs-var">etaForAllCo_co_maybe</span></a></span></span><span> </span><span id="local-6989586621680927213"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927213"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1117"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927212"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927212"><span class="hs-identifier hs-var">cv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927211"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927211"><span class="hs-identifier hs-var">kind_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927210"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927210"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (TyCoVar, Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitForAllCo_co_maybe"><span class="hs-identifier hs-var">splitForAllCo_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927213"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1118"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCoVar, Coercion, Coercion)
-&gt; Maybe (TyCoVar, Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927212"><span class="hs-identifier hs-var">cv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927211"><span class="hs-identifier hs-var">kind_co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927210"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1119"></span><span>
</span><span id="line-1120"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927209"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927209"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927208"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927208"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927213"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1121"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927207"><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927207"><span class="hs-identifier hs-var">cv1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVar, Type)
</span><a href="GHC.Core.Type.html#splitForAllTy_co_maybe"><span class="hs-identifier hs-var">splitForAllTy_co_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927209"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1122"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy_co"><span class="hs-identifier hs-var">isForAllTy_co</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927208"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1123"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927204"><span class="annot"><span class="annottext">kind_co :: Coercion
</span><a href="#local-6989586621680927204"><span class="hs-identifier hs-var hs-var">kind_co</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927213"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1124"></span><span>        </span><span id="local-6989586621680927203"><span class="annot"><span class="annottext">r :: Role
</span><a href="#local-6989586621680927203"><span class="hs-identifier hs-var hs-var">r</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Role
</span><a href="GHC.Core.Coercion.html#coVarRole"><span class="hs-identifier hs-var">coVarRole</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927207"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-1125"></span><span>        </span><span id="local-6989586621680927202"><span class="annot"><span class="annottext">l_co :: Coercion
</span><a href="#local-6989586621680927202"><span class="hs-identifier hs-var hs-var">l_co</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoVar -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkCoVarCo"><span class="hs-identifier hs-var">mkCoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927207"><span class="hs-identifier hs-var">cv1</span></a></span><span>
</span><span id="line-1126"></span><span>        </span><span id="local-6989586621680927201"><span class="annot"><span class="annottext">kind_co' :: Coercion
</span><a href="#local-6989586621680927201"><span class="hs-identifier hs-var hs-var">kind_co'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#downgradeRole"><span class="hs-identifier hs-var">downgradeRole</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927203"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927204"><span class="hs-identifier hs-var">kind_co</span></a></span><span>
</span><span id="line-1127"></span><span>        </span><span id="local-6989586621680927198"><span class="annot"><span class="annottext">r_co :: Coercion
</span><a href="#local-6989586621680927198"><span class="hs-identifier hs-var hs-var">r_co</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927203"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927201"><span class="hs-identifier hs-var">kind_co'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span>
</span><span id="line-1128"></span><span>                   </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927202"><span class="hs-identifier hs-var">l_co</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span>
</span><span id="line-1129"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; Int -&gt; Coercion -&gt; Coercion
Role -&gt; Int -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927203"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927201"><span class="hs-identifier hs-var">kind_co'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1130"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(TyCoVar, Coercion, Coercion)
-&gt; Maybe (TyCoVar, Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">TyCoVar
</span><a href="#local-6989586621680927207"><span class="hs-identifier hs-var">cv1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927204"><span class="hs-identifier hs-var">kind_co</span></a></span><span>
</span><span id="line-1131"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927213"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; Coercion -&gt; Coercion -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkProofIrrelCo"><span class="hs-identifier hs-var">mkProofIrrelCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927204"><span class="hs-identifier hs-var">kind_co</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927202"><span class="hs-identifier hs-var">l_co</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927198"><span class="hs-identifier hs-var">r_co</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1132"></span><span>
</span><span id="line-1133"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1134"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (TyCoVar, Coercion, Coercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1135"></span><span>
</span><span id="line-1136"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-type">etaAppCo_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1137"></span><span class="hs-comment">-- If possible, split a coercion</span><span>
</span><span id="line-1138"></span><span class="hs-comment">--   g :: t1a t1b ~ t2a t2b</span><span>
</span><span id="line-1139"></span><span class="hs-comment">-- into a pair of coercions (left g, right g)</span><span>
</span><span id="line-1140"></span><span id="etaAppCo_maybe"><span class="annot"><span class="annottext">etaAppCo_maybe :: Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#etaAppCo_maybe"><span class="hs-identifier hs-var hs-var">etaAppCo_maybe</span></a></span></span><span> </span><span id="local-6989586621680927197"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927197"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1141"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927196"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927196"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680927195"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927195"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; Maybe (Coercion, Coercion)
</span><a href="GHC.Core.Coercion.html#splitAppCo_maybe"><span class="hs-identifier hs-var">splitAppCo_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927197"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1142"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion, Coercion) -&gt; Maybe (Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927196"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927195"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1143"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927194"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927194"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927193"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927193"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; (Pair Type, Role)
</span><a href="GHC.Core.Coercion.html#coercionKindRole"><span class="hs-identifier hs-var">coercionKindRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927197"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1144"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680927192"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927192"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#splitAppTy_maybe"><span class="hs-identifier hs-var">splitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927194"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1145"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680927190"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927190"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#splitAppTy_maybe"><span class="hs-identifier hs-var">splitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927193"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1146"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927189"><span class="annot"><span class="annottext">isco1 :: Bool
</span><a href="#local-6989586621680927189"><span class="hs-identifier hs-var hs-var">isco1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isCoercionTy"><span class="hs-identifier hs-var">isCoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927192"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-1147"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927187"><span class="annot"><span class="annottext">isco2 :: Bool
</span><a href="#local-6989586621680927187"><span class="hs-identifier hs-var hs-var">isco2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isCoercionTy"><span class="hs-identifier hs-var">isCoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927190"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1148"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927189"><span class="hs-identifier hs-var">isco1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927187"><span class="hs-identifier hs-var">isco2</span></a></span><span>
</span><span id="line-1149"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Coercion, Coercion) -&gt; Maybe (Coercion, Coercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LeftOrRight -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-var">LRCo</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="GHC.Types.Basic.html#CLeft"><span class="hs-identifier hs-var">CLeft</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927197"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LeftOrRight -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.TyCo.Rep.html#LRCo"><span class="hs-identifier hs-var">LRCo</span></a></span><span> </span><span class="annot"><span class="annottext">LeftOrRight
</span><a href="GHC.Types.Basic.html#CRight"><span class="hs-identifier hs-var">CRight</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927197"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1150"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1151"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Coercion, Coercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1152"></span><span>
</span><span id="line-1153"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#etaTyConAppCo_maybe"><span class="hs-identifier hs-type">etaTyConAppCo_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1154"></span><span class="hs-comment">-- If possible, split a coercion</span><span>
</span><span id="line-1155"></span><span class="hs-comment">--       g :: T s1 .. sn ~ T t1 .. tn</span><span>
</span><span id="line-1156"></span><span class="hs-comment">-- into [ Nth 0 g :: s1~t1, ..., Nth (n-1) g :: sn~tn ]</span><span>
</span><span id="line-1157"></span><span id="etaTyConAppCo_maybe"><span class="annot"><span class="annottext">etaTyConAppCo_maybe :: TyCon -&gt; Coercion -&gt; Maybe [Coercion]
</span><a href="GHC.Core.Coercion.Opt.html#etaTyConAppCo_maybe"><span class="hs-identifier hs-var hs-var">etaTyConAppCo_maybe</span></a></span></span><span> </span><span id="local-6989586621680927186"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927186"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConAppCo"><span class="hs-identifier hs-type">TyConAppCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680927185"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927185"><span class="hs-identifier hs-var">tc2</span></a></span></span><span> </span><span id="local-6989586621680927184"><span class="annot"><span class="annottext">[Coercion]
</span><a href="#local-6989586621680927184"><span class="hs-identifier hs-var">cos2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1158"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tc</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">tc2</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">Just</span><span> </span><span class="hs-identifier">cos2</span><span>
</span><span id="line-1159"></span><span>
</span><span id="line-1160"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#etaTyConAppCo_maybe"><span class="hs-identifier hs-var">etaTyConAppCo_maybe</span></a></span><span> </span><span id="local-6989586621680927183"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927183"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680927182"><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927182"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1161"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#mustBeSaturated"><span class="hs-identifier hs-var">mustBeSaturated</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927183"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1162"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680927180"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927180"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680927179"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927179"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927178"><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927178"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; (Pair Type, Role)
</span><a href="GHC.Core.Coercion.html#coercionKindRole"><span class="hs-identifier hs-var">coercionKindRole</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927182"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1163"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927177"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927177"><span class="hs-identifier hs-var">tc1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927176"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927176"><span class="hs-identifier hs-var">tys1</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927180"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1164"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680927175"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927175"><span class="hs-identifier hs-var">tc2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680927174"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927174"><span class="hs-identifier hs-var">tys2</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680927179"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1165"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927177"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927175"><span class="hs-identifier hs-var">tc2</span></a></span><span>
</span><span id="line-1166"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Role -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isInjectiveTyCon"><span class="hs-identifier hs-var">isInjectiveTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927183"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927178"><span class="hs-identifier hs-var">r</span></a></span><span>  </span><span class="hs-comment">-- See Note [NthCo and newtypes] in GHC.Core.TyCo.Rep</span><span>
</span><span id="line-1167"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680927171"><span class="annot"><span class="annottext">n :: Int
</span><a href="#local-6989586621680927171"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927176"><span class="hs-identifier hs-var">tys1</span></a></span><span>
</span><span id="line-1168"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680927174"><span class="hs-identifier hs-var">tys2</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Int -&gt; Bool
forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthIs"><span class="hs-operator hs-var">`lengthIs`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927171"><span class="hs-identifier hs-var">n</span></a></span><span>      </span><span class="hs-comment">-- This can fail in an erroneous program</span><span>
</span><span id="line-1169"></span><span>                           </span><span class="hs-comment">-- E.g. T a ~# T a b</span><span>
</span><span id="line-1170"></span><span>                           </span><span class="hs-comment">-- #14607</span><span>
</span><span id="line-1171"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tc</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">tc1</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1172"></span><span>    </span><span class="annot"><span class="annottext">[Coercion] -&gt; Maybe [Coercion]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Coercion -&gt; [Role] -&gt; [Coercion]
</span><a href="GHC.Core.Coercion.html#decomposeCo"><span class="hs-identifier hs-var">decomposeCo</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680927171"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Coercion
</span><a href="#local-6989586621680927182"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesX"><span class="hs-identifier hs-var">tyConRolesX</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680927178"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680927177"><span class="hs-identifier hs-var">tc1</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1173"></span><span>    </span><span class="hs-comment">-- NB: n might be &lt;&gt; tyConArity tc</span><span>
</span><span id="line-1174"></span><span>    </span><span class="hs-comment">-- e.g.   data family T a :: * -&gt; *</span><span>
</span><span id="line-1175"></span><span>    </span><span class="hs-comment">--        g :: T a b ~ T c d</span><span>
</span><span id="line-1176"></span><span>
</span><span id="line-1177"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1178"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [Coercion]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1179"></span><span>
</span><span id="line-1180"></span><span class="hs-comment">{-
Note [Eta for AppCo]
~~~~~~~~~~~~~~~~~~~~
Suppose we have
   g :: s1 t1 ~ s2 t2

Then we can't necessarily make
   left  g :: s1 ~ s2
   right g :: t1 ~ t2
because it's possible that
   s1 :: * -&gt; *         t1 :: *
   s2 :: (*-&gt;*) -&gt; *    t2 :: * -&gt; *
and in that case (left g) does not have the same
kind on either side.

It's enough to check that
  kind t1 = kind t2
because if g is well-kinded then
  kind (s1 t2) = kind (s2 t2)
and these two imply
  kind s1 = kind s2

-}</span><span>
</span><span id="line-1203"></span><span>
</span><span id="line-1204"></span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#optForAllCoBndr"><span class="hs-identifier hs-type">optForAllCoBndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1205"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyCoVar"><span class="hs-identifier hs-type">TyCoVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Coercion.html#LiftingContext"><span class="hs-identifier hs-type">LiftingContext</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyCoVar"><span class="hs-identifier hs-type">TyCoVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span id="optForAllCoBndr"><span class="annot"><span class="annottext">optForAllCoBndr :: LiftingContext
-&gt; Bool
-&gt; TyCoVar
-&gt; Coercion
-&gt; (LiftingContext, TyCoVar, Coercion)
</span><a href="GHC.Core.Coercion.Opt.html#optForAllCoBndr"><span class="hs-identifier hs-var hs-var">optForAllCoBndr</span></a></span></span><span> </span><span id="local-6989586621680927168"><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927168"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680927167"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927167"><span class="hs-identifier hs-var">sym</span></a></span></span><span>
</span><span id="line-1207"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; (Coercion -&gt; Coercion)
-&gt; LiftingContext
-&gt; TyCoVar
-&gt; Coercion
-&gt; (LiftingContext, TyCoVar, Coercion)
</span><a href="GHC.Core.Coercion.html#substForAllCoBndrUsingLC"><span class="hs-identifier hs-var">substForAllCoBndrUsingLC</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927167"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LiftingContext -&gt; Bool -&gt; Bool -&gt; Role -&gt; Coercion -&gt; Coercion
</span><a href="GHC.Core.Coercion.Opt.html#opt_co4_wrap"><span class="hs-identifier hs-var">opt_co4_wrap</span></a></span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927168"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680927167"><span class="hs-identifier hs-var">sym</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LiftingContext
</span><a href="#local-6989586621680927168"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1208"></span></pre></body></html>